[latexila] Better place the completion window



commit a25ed0b36d7fab88481611cfd97bcf83ff461052
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Mar 16 20:01:16 2013 +0100

    Better place the completion window

 src/completion.vala |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/completion.vala b/src/completion.vala
index f897484..422d88d 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -127,6 +127,28 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
         return true;
     }
 
+    public bool get_start_iter (SourceCompletionContext context,
+        SourceCompletionProposal proposal, TextIter iter)
+    {
+        string? cmd = get_latex_command_at_iter (context.iter);
+
+        // In a LaTeX command argument, use the default implementation.
+        if (cmd == null)
+            return false;
+
+        // Custom implementation when in a LaTeX command name.
+        iter = context.iter;
+
+        if (! iter.starts_word ())
+            iter.backward_visible_word_start ();
+
+        TextIter prev = iter;
+        if (prev.backward_char () && prev.get_char () == '\\')
+            iter = prev;
+
+        return true;
+    }
+
     /*************************************************************************/
     // Populate: match() has returned true, now show the matches.
 


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