From 7c3ff94fc7c3242dff0c7290ee7dd0ec8be1e438 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 5 Jul 2006 12:37:46 +0000 Subject: [PATCH] Make sci_goto_line_scroll work better with line wrapping and folding git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@534 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 6 ++++++ src/sciwrappers.c | 14 +++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2977bd1..b5fbded0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-07-05 Nick Treleaven + + * src/sciwrappers.c: Make sci_goto_line_scroll work better with + line wrapping and folding. + + 2006-07-03 Nick Treleaven * src/utils.c, src/dialogs.c: diff --git a/src/sciwrappers.c b/src/sciwrappers.c index db91000a..641ff952 100644 --- a/src/sciwrappers.c +++ b/src/sciwrappers.c @@ -512,9 +512,9 @@ gboolean sci_get_line_is_visible(ScintillaObject* sci, gint line) } -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(ScintillaObject *sci, gint line, gboolean ensure_visibility) 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 }