[gnome-builder] search: Scroll to lefmost keeping word visible
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] search: Scroll to lefmost keeping word visible
- Date: Mon, 2 Feb 2015 14:21:07 +0000 (UTC)
commit 22f55af99cf6db134daac01654c1d14f59ee99f7
Author: Carlos Soriano <csoriano gnome org>
Date: Mon Feb 2 15:18:31 2015 +0100
search: Scroll to lefmost keeping word visible
When searching currently we put the searched word in the middle
of the view.
But normally the context of the program is at the left, so it's
interesting to keep the most part of the left side of the code
visible, while keeping the searched word fully visible.
To achieve that scroll the iter to the end of the word, keeping that
iter the rightmost possible, so the view stay in the leftmost possible.
src/editor/gb-editor-frame.c | 6 +++---
src/vim/gb-source-vim.c | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index b803d30..9d13017 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -212,9 +212,9 @@ found_match:
&match_begin, &match_end);
if (!gb_gtk_text_view_get_iter_visible (GTK_TEXT_VIEW (priv->source_view),
- &match_begin))
- gb_gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (priv->source_view),
- &match_begin, 0.0, TRUE, 0.5, 0.5);
+ &match_end))
+ gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (priv->source_view),
+ &match_end, 0.0, TRUE, 1.0, 0.5);
EXIT;
}
diff --git a/src/vim/gb-source-vim.c b/src/vim/gb-source-vim.c
index 77f24bd..ff28e2d 100644
--- a/src/vim/gb-source-vim.c
+++ b/src/vim/gb-source-vim.c
@@ -2526,8 +2526,8 @@ gb_source_vim_search_cb (GObject *source,
buffer = gtk_text_view_get_buffer (vim->priv->text_view);
gtk_text_buffer_select_range (buffer, &match_begin, &match_begin);
- gtk_text_view_scroll_to_iter (vim->priv->text_view, &match_begin,
- 0.0, TRUE, 0.0, 0.5);
+ gtk_text_view_scroll_to_iter (vim->priv->text_view, &match_end,
+ 0.0, TRUE, 1.0, 0.5);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]