diff --git a/twander.py b/twander.py index fca2019..762e10b 100755 --- a/twander.py +++ b/twander.py @@ -4,7 +4,7 @@ # For Updates See: http://www.tundraware.com/Software/twander PROGNAME = "twander" -RCSID = "$Id: twander.py,v 2.63 2003/01/16 23:08:02 tundra Exp $" +RCSID = "$Id: twander.py,v 2.64 2003/01/17 06:23:01 tundra Exp $" VERSION = RCSID.split()[2] @@ -205,7 +205,7 @@ # We'll use the following constant to mask them out # later in the keyboard and mouse handlers. -DontCareMask = LockMask +DontCareMask = LockMask | Mod2Mask | Mod3Mask | Mod4Mask | Mod5Mask # Some things are OS-dependent @@ -1180,7 +1180,7 @@ x, y = UI.DirList.winfo_pointerxy() # Position near mouse PopupMenu(UI.CmdBtn.menu, x, y) # Display Command Menu - elif event.state == (Button3Mask | AltMask): # Alt-Button-3 + elif event.state == (Button3Mask | ShiftMask | ControlMask): # Shift-Control-Button-3 x, y = UI.DirList.winfo_pointerxy() # Position near mouse PopupMenu(UI.HistBtn.menu, x, y) # Display Directory Menu @@ -1263,7 +1263,6 @@ # Unrecognized - Ignore else: - event.state = 0 return "break" parts = button.winfo_geometry().split('+') # Geometry returned as "WidthxHeight+X+Y" @@ -1617,7 +1616,7 @@ # Execute command (if any) - Blank entry means do nothing/return if cmd: - ExecuteCommand(cmd, pMANUALCMD, ResolveVars=TRUE) + ExecuteCommand(cmd, pMANUALCMD, ResolveVars=TRUE, SaveUnresolved=TRUE) # Save the command only if Command History is enabled (MAXHIST > 0) # AND one of two conditions exist: @@ -1736,9 +1735,7 @@ if dir: LoadDirList(dir) - # Inhibit other processing of this keystroke - event.state =0 - return + return "break" # End of 'FuncKeypress()' @@ -1764,7 +1761,7 @@ # Execute A Command ##### -def ExecuteCommand(cmd, name, UseStartDir=FALSE, ResolveVars=FALSE): +def ExecuteCommand(cmd, name, UseStartDir=FALSE, ResolveVars=FALSE, SaveUnresolved=FALSE): global UI @@ -1809,7 +1806,17 @@ # Update the Command History observing MAXHIST - UpdateMenu(UI.HistBtn, UI.CmdHist, MAXHIST, KeyRunCommand, newentry=cmd, fakeevent=TRUE) + # In most cases, we want to save the command with all the + # variables (Built-In, Environment, User-Defined) resolved (dereferenced). + # However, sometimes (e.g. manual command entry via KeyRunCommand()) we + # want to save the *unresolved* version. + + if SaveUnresolved: + savecmd = cmd + else: + savecmd = newcmd + + UpdateMenu(UI.HistBtn, UI.CmdHist, MAXHIST, KeyRunCommand, newentry=savecmd, fakeevent=TRUE) # Dump Command History stack if requested @@ -2345,7 +2352,8 @@ class event: pass - event.char = cmdkey + event.state = 0 + event.char = cmdkey KeystrokeHandler(event) # End Of 'CommandMenuSelection()'