changeset 39:30686583595d

Modified the default enso configuration so that the re-posting of key events for single-key quasimode sessions is possible.
author Atul Varma <varmaa@toolness.com>
date Sun, 24 Feb 2008 13:23:56 -0600
parents 1517f15208b6
children 835c7c35e4c4
files enso/config.py enso/ui/quasimode/__init__.py
diffstat 2 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/enso/config.py	Sun Feb 24 13:16:28 2008 -0600
+++ b/enso/config.py	Sun Feb 24 13:23:56 2008 -0600
@@ -21,12 +21,16 @@
 
 # The minimum number of characters the user must type before the
 # auto-completion mechanism engages.
-QUASIMODE_MIN_AUTOCOMPLETE_CHARS = 1
+QUASIMODE_MIN_AUTOCOMPLETE_CHARS = 2
 
 # The message displayed when the user types some text that is not a command.
 BAD_COMMAND_MSG = "<p><command>%s</command> is not a command.</p>"\
                   "%s"
 
+# Minimum number of characters that should have been typed into the 
+# quasimode for a bad command message to be shown. 
+BAD_COMMAND_MSG_MIN_CHARS = 2
+
 # The captions for the above message, indicating commands that are related
 # to the command the user typed.
 ONE_SUGG_CAPTION = "<caption>Did you mean <command>%s</command>?</caption>"
--- a/enso/ui/quasimode/__init__.py	Sun Feb 24 13:16:28 2008 -0600
+++ b/enso/ui/quasimode/__init__.py	Sun Feb 24 13:23:56 2008 -0600
@@ -334,13 +334,14 @@
         assert tempWindowRef() == None, "QuasimodeWindow wasn't destroyed!"
 
         activeCommand = self.__suggestionList.getActiveCommand()
+        userText = self.__suggestionList.getUserText()
         if activeCommand != None:
             cmdName = self.__suggestionList.getActiveCommandName()
             self.__executeCommand( activeCommand, cmdName )
-        elif len( self.__suggestionList.getUserText() ) > 0:
+        elif len( userText ) > config.BAD_COMMAND_MSG_MIN_CHARS:
             # The user typed some text, but there was no command match
-            self.__showBadCommandMsg( self.__suggestionList.getUserText() )
-            
+            self.__showBadCommandMsg( userText )
+
         self._inQuasimode = False
         self.__suggestionList.clearState()