[latexila] Use gtef_view_select_lines()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Use gtef_view_select_lines()
- Date: Fri, 18 Nov 2016 17:54:29 +0000 (UTC)
commit b72d9413e1c12a6d32dd0575837a7ac9c5e4c0ec
Author: Sébastien Wilmet <swilmet gnome org>
Date: Fri Nov 18 18:38:00 2016 +0100
Use gtef_view_select_lines()
src/document.vala | 9 ---------
src/latexila_app.vala | 2 +-
src/liblatexila/latexila-build-view.c | 5 ++++-
src/liblatexila/latexila-build-view.h | 6 +++---
src/main_window.vala | 3 ++-
src/main_window_build_tools.vala | 2 +-
6 files changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/src/document.vala b/src/document.vala
index 562f15a..b4b0e08 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -438,15 +438,6 @@ public class Document : Gtef.Buffer
end_user_action ();
}
- public void select_lines (int start, int end)
- {
- TextIter start_iter, end_iter;
- get_iter_at_line (out start_iter, start);
- get_iter_at_line (out end_iter, end);
- select_range (start_iter, end_iter);
- tab.view.scroll_to_cursor ();
- }
-
// If line is bigger than the number of lines of the document, the cursor is moved
// to the last line and false is returned.
public bool goto_line (int line)
diff --git a/src/latexila_app.vala b/src/latexila_app.vala
index c7b4ea0..a584d0a 100644
--- a/src/latexila_app.vala
+++ b/src/latexila_app.vala
@@ -457,7 +457,7 @@ public class LatexilaApp : Gtk.Application
MainWindow? main_window = get_active_main_window ();
if (main_window != null)
{
- main_window.jump_to_file_position (tex_file, line, line + 1);
+ main_window.jump_to_file_position (tex_file, line, line);
main_window.present_with_time (timestamp);
}
});
diff --git a/src/liblatexila/latexila-build-view.c b/src/liblatexila/latexila-build-view.c
index 462dbaa..a3d9d8d 100644
--- a/src/liblatexila/latexila-build-view.c
+++ b/src/liblatexila/latexila-build-view.c
@@ -359,6 +359,9 @@ latexila_build_view_class_init (LatexilaBuildViewClass *klass)
* The file should be opened and presented to the user. If @start_line and
* @end_line are not -1, jump to the @start_line and select those lines. If
* @start_line is provided, @end_line is also provided (different than -1).
+ *
+ * The selection should stop at the end of @end_line (not at the start of
+ * @end_line).
*/
signals[SIGNAL_JUMP_TO_FILE] = g_signal_new ("jump-to-file",
LATEXILA_TYPE_BUILD_VIEW,
@@ -728,7 +731,7 @@ latexila_build_view_append_single_message (LatexilaBuildView *build_view,
end_line = message->end_line;
if (message->start_line != -1 && end_line == -1)
- end_line = message->start_line + 1;
+ end_line = message->start_line;
gtk_tree_store_append (build_view->priv->store, &iter, parent);
gtk_tree_store_set (build_view->priv->store, &iter,
diff --git a/src/liblatexila/latexila-build-view.h b/src/liblatexila/latexila-build-view.h
index ff1bc9d..74283f4 100644
--- a/src/liblatexila/latexila-build-view.h
+++ b/src/liblatexila/latexila-build-view.h
@@ -77,15 +77,15 @@ typedef enum
* @type: the message type.
* @text: the text.
* @filename: reference to a certain file.
- * @start_line: reference to a line in the file. -1 to unset.
- * @end_line: reference to a line in the file. -1 to unset.
+ * @start_line: reference to a line in the file, counting from 1. -1 to unset.
+ * @end_line: reference to a line in the file, counting from 1. -1 to unset.
* @children: list of children of type #LatexilaBuildMsg.
* @expand: if the message has children, whether to initially show them.
*
* A build message, one line in the #GtkTreeView. If a @filename is provided,
* the file will be opened when the user clicks on the message. If @start_line
* and @end_line are provided, the lines between the two positions will be
- * selected.
+ * selected (the selection stops at the end of @end_line).
*/
struct _LatexilaBuildMsg
{
diff --git a/src/main_window.vala b/src/main_window.vala
index cf9b387..48bd24f 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -991,6 +991,7 @@ public class MainWindow : ApplicationWindow
}
// start_line and end_line begins at 0.
+ // The selection stops at the end of end_line (not at the start of end_line).
public void jump_to_file_position (File file, int start_line, int end_line)
{
return_if_fail (start_line >= 0 && end_line >= 0);
@@ -1000,7 +1001,7 @@ public class MainWindow : ApplicationWindow
// Ensure that the file is fully loaded before selecting the lines.
Utils.flush_queue ();
- tab.document.select_lines (start_line, end_line);
+ tab.view.select_lines (start_line, end_line);
}
/*************************************************************************/
diff --git a/src/main_window_build_tools.vala b/src/main_window_build_tools.vala
index bb2831c..e1151d3 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 - 1, end_line - 1);
});
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]