[latexila] Use gtef_iter_get_line_indentation()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Use gtef_iter_get_line_indentation()
- Date: Sat, 19 Nov 2016 11:48:22 +0000 (UTC)
commit c48d02699059cec22611b562d0b314a86625c5c1
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Nov 19 12:43:44 2016 +0100
Use gtef_iter_get_line_indentation()
src/completion.vala | 2 +-
src/document.vala | 23 -----------------------
src/latex_menu.vala | 2 +-
3 files changed, 2 insertions(+), 25 deletions(-)
---
diff --git a/src/completion.vala b/src/completion.vala
index a198604..8ac1e2b 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -495,7 +495,7 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
{
Document doc = iter.get_buffer () as Document;
- string cur_indent = doc.get_current_indentation (iter);
+ string cur_indent = Gtef.iter_get_line_indentation (iter);
string indent = doc.tab.view.get_indentation_style ();
CompletionChoice? env = _environments[env_name];
diff --git a/src/document.vala b/src/document.vala
index d332493..3055264 100644
--- a/src/document.vala
+++ b/src/document.vala
@@ -468,29 +468,6 @@ public class Document : Gtef.Buffer
return path.has_suffix (".tex");
}
- public string get_current_indentation (TextIter iter)
- {
- TextIter start_iter, end_iter;
- int line = iter.get_line ();
- get_iter_at_line (out start_iter, line);
- get_iter_at_line (out end_iter, line + 1);
-
- string text = get_text (start_iter, end_iter, false);
- string current_indent = "";
-
- int index = 0;
- unichar cur_char;
- while (text.get_next_char (ref index, out cur_char))
- {
- if (cur_char == ' ' || cur_char == '\t')
- current_indent += cur_char.to_string ();
- else
- break;
- }
-
- return current_indent;
- }
-
public DocumentStructure get_structure ()
{
if (_structure == null)
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index 172f5c2..a451abf 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -490,7 +490,7 @@ public class LatexMenu : Gtk.ActionGroup
if (text_before.contains ("\n") || text_after.contains ("\n"))
{
- string current_indent = active_document.get_current_indentation (start);
+ string current_indent = Gtef.iter_get_line_indentation (start);
if (current_indent != "")
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]