[latexila] Completion: little code clean-up



commit dbaab32fbaeb447d56f606d9e4e6fe441e0d1f38
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Thu Jan 19 15:54:34 2012 +0100

    Completion: little code clean-up
    
    Ouf, the code clean-up/refactoring is finished. It's ready to add new
    features!

 src/completion.vala |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/completion.vala b/src/completion.vala
index 5d25d37..fbfba6a 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -664,15 +664,15 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
     }
 
     // Get the command information: the prototype, and the package required if a package
-    // is required. In the prototype, the argument number 'num' is in bold.
+    // is required. In the prototype, the current argument ('cur_arg') is in bold.
     // By default, no argument is in bold.
-    private string get_command_info (CompletionCommand cmd, int num = -1)
+    private string get_command_info (CompletionCommand cmd, int cur_arg = -1)
     {
         string info = cmd.name;
-        int i = 1;
+        int arg_num = 1;
         foreach (CompletionArgument arg in cmd.args)
         {
-            if (num == i)
+            if (arg_num == cur_arg)
                 info += "<b>";
 
             if (arg.optional)
@@ -680,9 +680,10 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
             else
                 info += "{" + arg.label + "}";
 
-            if (num == i)
+            if (arg_num == cur_arg)
                 info += "</b>";
-            i++;
+
+            arg_num++;
         }
 
         if (cmd.package != null)



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