Kaydet (Commit) 60b7f681 authored tarafından Nick Treleaven's avatar Nick Treleaven

Scroll to 1/4 of visible lines when going to a line number.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@531 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 2b73b12c
......@@ -2,6 +2,8 @@
* src/utils.c, src/dialogs.c:
Fix a problem with the recent files menu.
* src/utils.c, src/sciwrappers.c, src/sciwrappers.h:
Scroll to 1/4 of visible lines when going to a line number.
2006-07-03 Enrico Tröger <enrico.troeger@uvena.de>
......
......@@ -669,6 +669,17 @@ 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);
vis1 = SSM(sci, SCI_GETFIRSTVISIBLELINE, 0, 0);
los = SSM(sci, SCI_LINESONSCREEN, 0, 0);
sci_scroll_lines(sci, (line - los * percent_of_view) - vis1);
}
void sci_marker_delete_all(ScintillaObject *sci, gint marker)
{
SSM(sci, SCI_MARKERDELETEALL, marker, 0);
......
......@@ -121,6 +121,7 @@ gint sci_search_prev (ScintillaObject * sci, gint flags, const gchar *text
gint sci_find_text (ScintillaObject * sci, gint flags, struct TextToFind *ttf);
void sci_set_font (ScintillaObject * sci, gint style, const gchar* font, gint size);
void sci_goto_line (ScintillaObject * sci, gint line, gboolean ensure_visibility);
void sci_goto_line_scroll (ScintillaObject * sci, gint line, gdouble percent_of_view);
void sci_marker_delete_all (ScintillaObject * sci, gint marker);
gint sci_get_style_at (ScintillaObject * sci, gint position);
void sci_set_symbol_margin (ScintillaObject * sci, gboolean set);
......
......@@ -526,13 +526,12 @@ gboolean utils_goto_line(gint idx, gint line)
if (idx == -1 || ! doc_list[idx].is_valid || line < 0)
return FALSE;
// mark the tag and ensure that we have arround 5 lines visible around the mark
sci_goto_line(doc_list[idx].sci, line - 5, FALSE);
sci_goto_line(doc_list[idx].sci, line + 5, FALSE);
sci_goto_line(doc_list[idx].sci, line, TRUE);
// mark the tag
sci_marker_delete_all(doc_list[idx].sci, 0);
sci_set_marker_at_line(doc_list[idx].sci, line, TRUE, 0);
sci_goto_line_scroll(doc_list[idx].sci, line, 0.25);
// finally switch to the page
page_num = gtk_notebook_page_num(GTK_NOTEBOOK(app->notebook), GTK_WIDGET(doc_list[idx].sci));
gtk_notebook_set_current_page(GTK_NOTEBOOK(app->notebook), page_num);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment