diff --git a/twander.py b/twander.py index 7fc3810..657888b 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 2.87 2003/01/31 00:50:13 tundra Exp $" +RCSID = "$Id: twander.py,v 2.88 2003/01/31 19:01:05 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -202,12 +202,17 @@ ##### +# Symbolic Constants Needed Below +##### + +NOCMDSHELL = '""' + +##### # Defaults ##### - AUTOREFRESH = TRUE # Automatically refresh the directory display -CMDSHELL = "[VSHELL]" # Shell definition to use with manual command invocations +CMDSHELL = NOCMDSHELL # Shell definition to use with manual command invocations DEBUGLEVEL = 0 # No debug output MAXDIR = 32 # Maximum number of directories to track MAXDIRBUF = 250 # Maximum size of UI.AllDirs @@ -897,7 +902,11 @@ elif name in UI.OptionsNumeric.keys(): try: - globals()[name] = StringToNum(val) + val = StringToNum(val) + if val >= 0: + globals()[name] = val + else: + WrnMsg(wBADRHS % (num, line)) except: WrnMsg(wBADRHS % (num, line)) return @@ -1817,11 +1826,19 @@ def KeySelAll(event): - # Unselect first item in case it was - UI.DirList.selection_clear(0) + # In the case of a Drive List View, we want to literally + # select everything. In all other cases, we do not + # want this feature to select the first item which is ".." + + if UI.CurrentDir == SHOWDRIVES: + UI.DirList.selection_set(0, END) + + else: + # Unselect first item in case it was + UI.DirList.selection_clear(0) - # We never want to select the first item which is ".." - UI.DirList.selection_set(1, END) + # We never want to select the first item which is ".." + UI.DirList.selection_set(1, END) # End of 'KeySelAll()' @@ -1842,8 +1859,11 @@ for v in cs: UI.DirList.selection_clear(v) - # And we never select ".." this way - UI.DirList.selection_clear(0) + # If we're not in a Drive List View, we never + # select the first entry (".." this way) + + if UI.CurrentDir != SHOWDRIVES: + UI.DirList.selection_clear(0) # End of 'KeySelInv()' @@ -1974,6 +1994,18 @@ # Prompt with passed initial edit string if initial: + + # This feature is invoked with an initial string when we + # are playing back something from the command history. + # If the CMDSHELL feature is enabled, we need to insure + # that we do not prepend that string multiple times as + # the command is reinvoked. We do that by removing that + # prepended string from the passed initial string. + # We also want to remove the previously added single quotes. + + if (CMDSHELL != NOCMDSHELL) and initial.startswith(CMDSHELL): + initial = initial[len(CMDSHELL)+2:-1] + cmd = askstring(pRUNCMD, pENCMD, initialvalue=initial) # Prompt with last manually entered command @@ -1987,10 +2019,15 @@ # Execute command (if any) - Blank entry means do nothing/return if cmd: - # On Unix systems, prepend the default shell string if it is enabled + # Prepend the mycmd = cmd - if OSNAME == 'posix' and CMDSHELL != '[]': - mycmd = "%s '%s'" % (CMDSHELL, cmd) + + if CMDSHELL != NOCMDSHELL: # See if feature is enabled + if not mycmd.startswith('\\'): # See if user is trying to escape the feature + mycmd = "%s '%s'" % (CMDSHELL, cmd) + + else: # User is escaping the feature + mycmd = mycmd[1:] ExecuteCommand(mycmd, pMANUALCMD, ResolveVars=TRUE, SaveUnresolved=TRUE)