SF.net SVN: geany: [534] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Jul 5 12:37:53 UTC 2006


Revision: 534
Author:   ntrel
Date:     2006-07-05 05:37:46 -0700 (Wed, 05 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=534&view=rev

Log Message:
-----------
Make sci_goto_line_scroll work better with line wrapping and folding

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/sciwrappers.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-07-04 21:31:08 UTC (rev 533)
+++ trunk/ChangeLog	2006-07-05 12:37:46 UTC (rev 534)
@@ -1,3 +1,9 @@
+2006-07-05  Nick Treleaven  <nick.treleaven at btinternet.com>
+
+ * src/sciwrappers.c: Make sci_goto_line_scroll work better with
+                      line wrapping and folding.
+
+
 2006-07-03  Nick Treleaven  <nick.treleaven at btinternet.com>
 
  * src/utils.c, src/dialogs.c:

Modified: trunk/src/sciwrappers.c
===================================================================
--- trunk/src/sciwrappers.c	2006-07-04 21:31:08 UTC (rev 533)
+++ trunk/src/sciwrappers.c	2006-07-05 12:37:46 UTC (rev 534)
@@ -512,9 +512,9 @@
 }
 
 
-void sci_ensure_line_is_visible( ScintillaObject* sci, gint line)
+void sci_ensure_line_is_visible(ScintillaObject* sci, gint line)
 {
-	 SSM(sci,SCI_ENSUREVISIBLE,line,0);
+	SSM(sci,SCI_ENSUREVISIBLE,line,0);
 }
 
 
@@ -671,12 +671,16 @@
 
 void sci_goto_line_scroll(ScintillaObject *sci, gint line, gdouble percent_of_view)
 {
-	gint vis1, los;
-	SSM(sci, SCI_GOTOLINE, line, 0);
+	gint vis1, los, delta;
 
+	sci_goto_line(sci, line, TRUE);
+	// sci 'visible line' != file line number
 	vis1 = SSM(sci, SCI_GETFIRSTVISIBLELINE, 0, 0);
+	vis1 = SSM(sci, SCI_DOCLINEFROMVISIBLE, vis1, 0);
 	los = SSM(sci, SCI_LINESONSCREEN, 0, 0);
-	sci_scroll_lines(sci, (line - los * percent_of_view) - vis1);
+	delta = (line - vis1) - los * percent_of_view;
+	sci_scroll_lines(sci, delta);
+	sci_scroll_caret(sci); //ensure visible, in case of excessive folding/wrapping
 }
 
 


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