Browse Source

Add tabcompletion.allowempty setting and don't complete empty strings

unless it's set. Fixes issue 1446.
tags/0.6.3m1rc1
Chris Smith 15 years ago
parent
commit
8c4a2cf92e

+ 1
- 0
src/com/dmdirc/config/defaults/default/defaults View File

@@ -187,6 +187,7 @@ channel:
187 187
   encoding=UTF-8
188 188
 
189 189
 tabcompletion:
190
+  allowempty=false
190 191
   casesensitive=false
191 192
   style=mirc
192 193
 

+ 8
- 0
src/com/dmdirc/ui/input/TabCompleter.java View File

@@ -36,6 +36,7 @@ import java.util.Map;
36 36
 
37 37
 /**
38 38
  * The tab completer handles a user's request to tab complete some word.
39
+ * 
39 40
  * @author chris
40 41
  */
41 42
 public final class TabCompleter implements Serializable {
@@ -52,6 +53,7 @@ public final class TabCompleter implements Serializable {
52 53
      * from this completer.
53 54
      */
54 55
     private TabCompleter parent;
56
+
55 57
     /**
56 58
      * The entries in this completer.
57 59
      */
@@ -88,6 +90,12 @@ public final class TabCompleter implements Serializable {
88 90
         
89 91
         final boolean caseSensitive = IdentityManager.getGlobalConfig()
90 92
                 .getOptionBool("tabcompletion", "casesensitive");
93
+        final boolean allowEmpty = IdentityManager.getGlobalConfig()
94
+                .getOptionBool("tabcompletion", "allowempty");
95
+
96
+        if (partial.isEmpty() && !allowEmpty) {
97
+            return result;
98
+        }
91 99
                 
92 100
         if (additionals != null) {
93 101
             targets.safeGet(TabCompletionType.ADDITIONAL).addAll(additionals);

Loading…
Cancel
Save