SF.net SVN: geany: [1145] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Sun Dec 24 12:32:53 UTC 2006


Revision: 1145
          http://svn.sourceforge.net/geany/?rev=1145&view=rev
Author:   ntrel
Date:     2006-12-24 04:32:52 -0800 (Sun, 24 Dec 2006)

Log Message:
-----------
Improve accuracy of sci_scroll_to_line() when line wrapping and/or
folding is used.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-12-24 12:07:35 UTC (rev 1144)
+++ trunk/ChangeLog	2006-12-24 12:32:52 UTC (rev 1145)
@@ -3,6 +3,9 @@
  * src/utils.c, src/sci_cb.c:
    Only call SCI_BRACEMATCH once in sci_cb_highlight_braces().
    Separate find_calltip() from sci_cb_show_calltip().
+ * src/sciwrappers.c:
+   Improve accuracy of sci_scroll_to_line() when line wrapping and/or
+   folding is used.
 
 
 2006-12-22  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/src/sciwrappers.c
===================================================================
--- trunk/src/sciwrappers.c	2006-12-24 12:07:35 UTC (rev 1144)
+++ trunk/src/sciwrappers.c	2006-12-24 12:32:52 UTC (rev 1145)
@@ -678,17 +678,19 @@
 {
 	gint vis1, los, delta;
 
-	if (GTK_WIDGET(sci)->allocation.height <= 1) return;	// prevent gdk_window_scroll warning
+	if (GTK_WIDGET(sci)->allocation.height <= 1) return;	// try to prevent gdk_window_scroll warning
 	if (line == -1)
 		line = sci_get_current_line(sci, -1);
 
-	// sci 'visible line' != file line number
+	// sci 'visible line' != doc line number because of folding and line wrapping
+	/* calling SCI_VISIBLEFROMDOCLINE for line is more accurate than calling
+	 * SCI_DOCLINEFROMVISIBLE for vis1. */
+	line = SSM(sci, SCI_VISIBLEFROMDOCLINE, line, 0);
 	vis1 = SSM(sci, SCI_GETFIRSTVISIBLELINE, 0, 0);
-	vis1 = SSM(sci, SCI_DOCLINEFROMVISIBLE, vis1, 0);
 	los = SSM(sci, SCI_LINESONSCREEN, 0, 0);
 	delta = (line - vis1) - los * percent_of_view;
 	sci_scroll_lines(sci, delta);
-	sci_scroll_caret(sci); //ensure visible, in case of excessive folding/wrapping
+	sci_scroll_caret(sci); // ensure visible (maybe not needed now)
 }
 
 


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