[gedit/dbus] Implement goto column when opening already opened document
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/dbus] Implement goto column when opening already opened document
- Date: Sun, 2 May 2010 22:41:31 +0000 (UTC)
commit d599034c468d05433196b9defd44f7f7ad41588a
Author: Jesse van den Kieboom <jessevdk gnome org>
Date: Mon May 3 00:41:04 2010 +0200
Implement goto column when opening already opened document
gedit/gedit-commands-file.c | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index b4d2c54..1a8d0c6 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -149,20 +149,32 @@ load_file_list (GeditWindow *window,
{
if (l == files)
{
+ GeditDocument *doc;
+
gedit_window_set_active_tab (window, tab);
jump_to = FALSE;
+ doc = gedit_tab_get_document (tab);
if (line_pos > 0)
{
- GeditDocument *doc;
- GeditView *view;
-
- doc = gedit_tab_get_document (tab);
- view = gedit_tab_get_view (tab);
-
/* document counts lines starting from 0 */
- gedit_document_goto_line (doc, line_pos - 1);
- gedit_view_scroll_to_cursor (view);
+ if (column_pos > 0)
+ {
+ GtkTextIter iter;
+
+ gtk_text_buffer_get_iter_at_line_offset (GTK_TEXT_BUFFER (doc),
+ &iter,
+ line_pos - 1,
+ column_pos - 1);
+
+ gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &iter);
+ }
+ else
+ {
+ gedit_document_goto_line (doc, line_pos - 1);
+ }
+
+ gedit_view_scroll_to_cursor (gedit_tab_get_view (tab));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]