[latexila] Add completion menu item (ctrl+space)



commit d99e444c434fc0b825af2954f196af8325977073
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Aug 20 21:39:29 2014 +0200

    Add completion menu item (ctrl+space)
    
    The Ctrl+space shortcut was documented nowhere in the interface, only in
    the documentation. Now with the menu item, the Ctrl+space shortcut is
    more discoverable.
    
    Several years ago there was a bug with the "fr oss" keyboard layout: a
    space (without the Ctrl modifier pressed) triggered Ctrl+space, see
    https://bugzilla.gnome.org/show_bug.cgi?id=611089
    It seems to be fixed now.

 src/main_window_edit.vala |   12 +++++++++++-
 src/ui/ui.xml             |    3 ++-
 2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/main_window_edit.vala b/src/main_window_edit.vala
index 3e5739b..4bbdfa6 100644
--- a/src/main_window_edit.vala
+++ b/src/main_window_edit.vala
@@ -62,6 +62,9 @@ public class MainWindowEdit
             N_("Uncomment the selected lines (remove the character \"%\")"),
             on_uncomment },
 
+        { "EditCompletion", null, N_("_Completion"), "<Control>space",
+            N_("Complete the LaTeX command"), on_completion },
+
         { "EditPreferences", Stock.PREFERENCES, null, null,
             N_("Configure the application"), on_open_preferences }
     };
@@ -126,7 +129,8 @@ public class MainWindowEdit
             "EditDelete",
             "EditSelectAll",
             "EditComment",
-            "EditUncomment"
+            "EditUncomment",
+            "EditCompletion"
         };
 
         foreach (string action_name in action_names)
@@ -248,6 +252,12 @@ public class MainWindowEdit
         _main_window.active_document.uncomment_selected_lines ();
     }
 
+    public void on_completion ()
+    {
+        return_if_fail (_main_window.active_tab != null);
+        _main_window.active_view.show_completion ();
+    }
+
     public void on_spell_checking (Gtk.Action action)
     {
         bool activate = (action as ToggleAction).active;
diff --git a/src/ui/ui.xml b/src/ui/ui.xml
index caac399..c5d9464 100644
--- a/src/ui/ui.xml
+++ b/src/ui/ui.xml
@@ -43,12 +43,13 @@ along with LaTeXila.  If not, see <http://www.gnu.org/licenses/>.
       <menuitem action="EditCopy" />
       <menuitem action="EditPaste" />
       <menuitem action="EditDelete" />
-      <separator />
       <menuitem action="EditSelectAll" />
       <separator />
       <menuitem action="EditComment" />
       <menuitem action="EditUncomment" />
       <separator />
+      <menuitem action="EditCompletion" />
+      <separator />
       <menuitem action="EditSpellChecking" />
       <separator />
       <menuitem action="EditPreferences" />


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