SF.net SVN: geany:[5098] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Jul 9 12:12:24 UTC 2010


Revision: 5098
          http://geany.svn.sourceforge.net/geany/?rev=5098&view=rev
Author:   ntrel
Date:     2010-07-09 12:12:23 +0000 (Fri, 09 Jul 2010)

Log Message:
-----------
Fix scrolling the editor line in view after loading a session and
switching document tabs. Note this causes repainting so needs
improvement.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/editor.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-07-08 16:59:11 UTC (rev 5097)
+++ trunk/ChangeLog	2010-07-09 12:12:23 UTC (rev 5098)
@@ -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-08  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/ui_utils.c, doc/geany.txt, doc/geany.html:

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2010-07-08 16:59:11 UTC (rev 5097)
+++ trunk/src/editor.c	2010-07-09 12:12:23 UTC (rev 5098)
@@ -394,16 +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);
-		/* disable further scrolling */
-		editor->scroll_percent = -1.0F;
-	}
 #if 0
 	/** experimental code for inverting selections */
 	{
@@ -911,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)
 			{
@@ -4698,13 +4705,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