SF.net SVN: geany:[5143] branches/Geany-0_19_1

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Aug 11 14:44:21 UTC 2010


Revision: 5143
          http://geany.svn.sourceforge.net/geany/?rev=5143&view=rev
Author:   ntrel
Date:     2010-08-11 14:44:21 +0000 (Wed, 11 Aug 2010)

Log Message:
-----------
r5098

Modified Paths:
--------------
    branches/Geany-0_19_1/ChangeLog
    branches/Geany-0_19_1/src/editor.c

Modified: branches/Geany-0_19_1/ChangeLog
===================================================================
--- branches/Geany-0_19_1/ChangeLog	2010-08-11 14:41:15 UTC (rev 5142)
+++ branches/Geany-0_19_1/ChangeLog	2010-08-11 14:44:21 UTC (rev 5143)
@@ -1,3 +1,11 @@
+2010-07-09  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
+
+ * src/editor.c:
+   Fix scrolling the editor line in view after loading a session and
+   switching document tabs. Note this causes repainting so needs
+   improvement.
+
+
 2010-07-07  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/build.c, src/project.c, src/project.h:

Modified: branches/Geany-0_19_1/src/editor.c
===================================================================
--- branches/Geany-0_19_1/src/editor.c	2010-08-11 14:41:15 UTC (rev 5142)
+++ branches/Geany-0_19_1/src/editor.c	2010-08-11 14:44:21 UTC (rev 5143)
@@ -394,15 +394,6 @@
 
 	ui_update_statusbar(editor->document, pos);
 
-	/* Visible lines are only laid out accurately once [SCN_UPDATEUI] is sent,
-	 * so we need to only call sci_scroll_to_line here, because the document
-	 * may have line wrapping and folding enabled.
-	 * http://scintilla.sourceforge.net/ScintillaDoc.html#LineWrapping */
-	if (editor->scroll_percent > 0.0F)
-	{
-		editor_scroll_to_line(editor, -1, editor->scroll_percent);
-		editor->scroll_percent = -1.0F;	/* disable further scrolling */
-	}
 #if 0
 	/** experimental code for inverting selections */
 	{
@@ -910,6 +901,23 @@
 			on_update_ui(editor, nt);
 			break;
 
+		case SCN_PAINTED:
+			/* Visible lines are only laid out accurately just before painting,
+			 * so we need to only call editor_scroll_to_line here, because the document
+			 * may have line wrapping and folding enabled.
+			 * http://scintilla.sourceforge.net/ScintillaDoc.html#LineWrapping
+			 * This is important e.g. when loading a session and switching pages
+			 * and having the cursor scroll in view. */
+			 /* FIXME: Really we want to do this just before painting, not after it
+			  * as it will cause repainting. */
+			if (editor->scroll_percent > 0.0F)
+			{
+				editor_scroll_to_line(editor, -1, editor->scroll_percent);
+				/* disable further scrolling */
+				editor->scroll_percent = -1.0F;
+			}
+			break;
+
  		case SCN_MODIFIED:
 			if (editor_prefs.show_linenumber_margin && (nt->modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) && nt->linesAdded)
 			{
@@ -4699,13 +4707,13 @@
 }
 
 
-/* This is just to catch any uncolourised documents being drawn that didn't receive focus
- * for some reason, maybe it's not necessary but just in case. */
 static gboolean on_editor_expose_event(GtkWidget *widget, GdkEventExpose *event,
 		gpointer user_data)
 {
 	GeanyEditor *editor = user_data;
 
+	/* This is just to catch any uncolourised documents being drawn that didn't receive focus
+	 * for some reason, maybe it's not necessary but just in case. */
 	editor_check_colourise(editor);
 	return FALSE;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list