diff --git a/twander.py b/twander.py index 9508829..9002441 100755 --- a/twander.py +++ b/twander.py @@ -6,7 +6,7 @@ # Program Information PROGNAME = "twander" -RCSID = "$Id: twander.py,v 3.188 2005/02/01 22:36:33 tundra Exp $" +RCSID = "$Id: twander.py,v 3.189 2005/02/01 23:09:01 tundra Exp $" VERSION = RCSID.split()[2] # Copyright Information @@ -1008,8 +1008,9 @@ def FilterWildcardMatch(matchthis): # Accomodate case-insensitive matching + # But strict matching overrides this - if WILDNOCASE: + if WILDNOCASE and not UI.FilterWildcard[3]: wc = UI.FilterWildcard[2] matchthis = matchthis.lower() @@ -2441,7 +2442,7 @@ autostate = YesOrNo[AUTOREFRESH] + refreshing filterwc = UI.FilterWildcard[0] - if WILDNOCASE: + if WILDNOCASE and not UI.FilterWildcard[3]: filterwc = filterwc.lower() if INVERTFILTER: filterwc = "NOT " + filterwc @@ -3032,7 +3033,7 @@ ##### -# Event Handler: Select Using Wildcard +# Event Handler: Filter Or Select Using Wildcard ##### def KeySelWild(event, initial="", FilterWildcard=False): @@ -3060,10 +3061,13 @@ KeySelNone(event) # Unless the user indicates otherwise, cook the regex so - # a match can occur anywhere on the line. + # a match can occur anywhere on the line. If the user wants + # strict matching, save this fact so it can escape WILDNOCASE. + strict = False if uwc[0] == STRICTMATCH: wc = uwc[1:] + strict = True else: wc = r".*" + uwc @@ -3083,7 +3087,7 @@ # This function can be called to use wildcards to: 1) Filter file list or 2) Select files if FilterWildcard: - UI.FilterWildcard = (wc, wild, wildl) + UI.FilterWildcard = (wc, wild, wildl, strict) RefreshDirList(None) else: @@ -3097,13 +3101,13 @@ matches = [] wc = wild - if WILDNOCASE: + if WILDNOCASE and not strict: wc = wildl for x in range(1,UI.DirList.size()): matchthis = UI.DirList.get(x) - if WILDNOCASE: + if WILDNOCASE and not strict: matchthis = matchthis.lower() if wc.match(matchthis): @@ -3122,7 +3126,7 @@ if (MAXMENU > 0) and ((not initial) or (uwc != initial)): UI.LastSelWildcard = uwc - # Add this wildcard to the menu if its not there alread + # Add this wildcard to the menu if its not there already if uwc not in UI.WildHist: UpdateMenu(UI.WildBtn, UI.WildHist, MAXMENU, MAXMENUBUF, KeySelWild, newentry=uwc, fakeevent=True) @@ -3620,7 +3624,7 @@ return # Reset any active filtering - UI.FilterWildcard = ("None", None, None) + UI.FilterWildcard = ("None", None, None, False) # Transform double forward-slashes into a single # forward-slash. This keeps the Directory Stack @@ -4604,7 +4608,7 @@ # Clearout any active wildcard filtering if asked to if ClearFilterWildcard: - UI.FilterWildcard = ("None", None, None) + UI.FilterWildcard = ("None", None, None, False) INVERTFILTER = False @@ -5046,7 +5050,7 @@ UI.CurrentDir = "" # Initialize storage for filtering wildcard -UI.FilterWildcard = ("None", None, None) +UI.FilterWildcard = ("None", None, None, False) # Initialize various menu data structures ClearHistory(None)