Revision: 1923 http://geany.svn.sourceforge.net/geany/?rev=1923&view=rev Author: eht16 Date: 2007-10-01 05:22:44 -0700 (Mon, 01 Oct 2007)
Log Message: ----------- Fix scrolling bugs when searching text and the cursor is outside of the current visible area. Unfold search result. Also print version of Geany together with GTK/GLib version information.
Modified Paths: -------------- trunk/ChangeLog trunk/src/callbacks.c trunk/src/document.c trunk/src/main.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-10-01 11:46:19 UTC (rev 1922) +++ trunk/ChangeLog 2007-10-01 12:22:44 UTC (rev 1923) @@ -1,3 +1,12 @@ +2007-10-01 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/document.c: Fix scrolling bugs when searching text and the cursor + is outside of the current visible area. + Unfold search result. + * src/main.c: Also print version of Geany together with GTK/GLib + version information. + + 2007-10-01 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* tagmanager/python.c:
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2007-10-01 11:46:19 UTC (rev 1922) +++ trunk/src/callbacks.c 2007-10-01 12:22:44 UTC (rev 1923) @@ -654,7 +654,6 @@ on_toolbutton18_clicked (GtkToolButton *toolbutton, gpointer user_data) { - //on_entry1_changed(NULL, NULL); gint idx = document_get_cur_idx(); gboolean result; GtkWidget *entry = lookup_widget(GTK_WIDGET(app->window), "entry1");
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2007-10-01 11:46:19 UTC (rev 1922) +++ trunk/src/document.c 2007-10-01 12:22:44 UTC (rev 1923) @@ -1268,9 +1268,16 @@
if (search_pos != -1) { + // unfold maybe folded results + sci_ensure_line_is_visible(doc_list[idx].sci, + sci_get_line_from_position(doc_list[idx].sci, ttf.chrgText.cpMin)); + sci_set_selection_start(doc_list[idx].sci, ttf.chrgText.cpMin); sci_set_selection_end(doc_list[idx].sci, ttf.chrgText.cpMax); - doc_list[idx].scroll_percent = 0.3F; + + // we need to force scrolling in case the cursor is outside of the current visible area + // doc_list[].scroll_percent doesn't work because sci isn't always updated while searching + editor_scroll_to_line(doc_list[idx].sci, -1, 0.3F); return TRUE; } else @@ -1292,15 +1299,13 @@ gint document_find_text(gint idx, const gchar *text, gint flags, gboolean search_backwards, gboolean scroll, GtkWidget *parent) { - gint selection_end, selection_start, search_pos, first_visible_line; + gint selection_end, selection_start, search_pos;
g_return_val_if_fail(text != NULL, -1); if (idx == -1 || ! *text) return -1; // Sci doesn't support searching backwards with a regex if (flags & SCFIND_REGEXP) search_backwards = FALSE;
- first_visible_line = sci_get_first_visible_line(doc_list[idx].sci); - selection_start = sci_get_selection_start(doc_list[idx].sci); selection_end = sci_get_selection_end(doc_list[idx].sci); if ((selection_end - selection_start) > 0) @@ -1319,6 +1324,9 @@
if (search_pos != -1) { + // unfold maybe folded results + sci_ensure_line_is_visible(doc_list[idx].sci, + sci_get_line_from_position(doc_list[idx].sci, search_pos)); if (scroll) doc_list[idx].scroll_percent = 0.3F; }
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2007-10-01 11:46:19 UTC (rev 1922) +++ trunk/src/main.c 2007-10-01 12:22:44 UTC (rev 1923) @@ -650,7 +650,8 @@ } #endif
- geany_debug("GTK+ %u.%u.%u, GLib %u.%u.%u", + geany_debug("Geany %s, GTK+ %u.%u.%u, GLib %u.%u.%u", + VERSION, gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version); gtk_init(&argc, &argv);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.