[latexila] BuildView: count from 0 for start/end_line in ::jump-to-file



commit f4510ed205c82d6bc76f5c234d94c2497c23e524
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Nov 18 18:49:49 2016 +0100

    BuildView: count from 0 for start/end_line in ::jump-to-file
    
    So the call to _main_window.jump_to_file_position() is more natural.

 src/liblatexila/latexila-build-view.c |   11 +++++++++--
 src/main_window_build_tools.vala      |    2 +-
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/liblatexila/latexila-build-view.c b/src/liblatexila/latexila-build-view.c
index a3d9d8d..d443cab 100644
--- a/src/liblatexila/latexila-build-view.c
+++ b/src/liblatexila/latexila-build-view.c
@@ -351,8 +351,8 @@ latexila_build_view_class_init (LatexilaBuildViewClass *klass)
    * LatexilaBuildView::jump-to-file:
    * @build_view: a #LatexilaBuildView.
    * @file: the file to open.
-   * @start_line: the line where to jump and the start of the selection, or -1.
-   * @end_line: the end of the selection, or -1.
+   * @start_line: the start of the selection, counting from 0. Or -1 if unset.
+   * @end_line: the end of the selection, counting from 0. Or -1 if unset.
    *
    * The ::jump-to-file signal is emitted when a row in the build view is
    * selected. The row must contain a file, otherwise the signal is not emitted.
@@ -456,6 +456,13 @@ select_row (LatexilaBuildView *build_view,
                       COLUMN_END_LINE, &end_line,
                       -1);
 
+  /* For the signal, we count from 0. */
+  if (start_line > 0)
+    start_line--;
+
+  if (end_line > 0)
+    end_line--;
+
   if (file != NULL)
     {
       g_signal_emit (build_view,
diff --git a/src/main_window_build_tools.vala b/src/main_window_build_tools.vala
index e1151d3..b7c9fdc 100644
--- a/src/main_window_build_tools.vala
+++ b/src/main_window_build_tools.vala
@@ -108,7 +108,7 @@ public class MainWindowBuildTools
             if (start_line == -1)
                 _main_window.open_document (file);
             else
-                _main_window.jump_to_file_position (file, start_line - 1, end_line - 1);
+                _main_window.jump_to_file_position (file, start_line, end_line);
         });
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]