diff --git a/twander.py b/twander.py index 84cf800..613f597 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.26 2002/12/18 22:38:20 tundra Exp $" +RCSID = "$Id: twander.py,v 2.27 2002/12/18 23:58:19 tundra Exp $" VERSION = RCSID.split()[2] @@ -226,6 +226,7 @@ DIR = r'[DIR]' DSELECTION = r'[DSELECTION]' DSELECTIONS = r'[DSELECTIONS]' +HASH = r'[HASH]' PROMPT = r'[PROMPT:' SELECTION = r'[SELECTION]' SELECTIONS = r'[SELECTIONS]' @@ -464,7 +465,6 @@ ##### # Parse A Line From A Configuration File -# Routine Assumes That Comments Previously Removed ##### @@ -476,30 +476,11 @@ if line[-1] == '\n': line = line[:-1] - # Split configuration line into separate fields - fields = line.split() - - # Process Comments. This is tricky because we want to *allow* the - # comment string as a part of Command Definitions and chop it - # to EOL everywhere else. Lines which meet the following - # critera are considered Command Definitions and have no - # comment processing applied: - # - # Line must contain at least 3 fields - # - # 1st field must be one character long - # - # 1st field cannot be "#" - # (or many comments would look like Command Definitions) - - if (len(fields) >= 3) and (len(fields[0]) == 1) and (fields[0] != COMMENT): - pass - - # Not a Command Definition, strip from comment introducer to EOL - else: - idx = line.find(COMMENT) - if idx > -1: - line = line[:idx] + # Strip comments out + + idx = line.find(COMMENT) + if idx > -1: + line = line[:idx] # Split what's left into separate fields again fields = line.split() @@ -1025,6 +1006,7 @@ cmd = cmd.replace(DIR, QUOTECHAR + UI.CurrentDir + QUOTECHAR) cmd = cmd.replace(DSELECTION, QUOTECHAR + UI.CurrentDir + selection + QUOTECHAR) cmd = cmd.replace(DSELECTIONS, dselections) + cmd = cmd.replace(HASH, COMMENT) cmd = cmd.replace(SELECTION, QUOTECHAR + selection + QUOTECHAR) cmd = cmd.replace(SELECTIONS, selections) @@ -1806,8 +1788,8 @@ STARTDIR = os.path.abspath(STARTDIR) # Setup builtin variables -UI.BuiltIns = {DIR:"", SELECTION:"", SELECTIONS:"", DSELECTION:"", - DSELECTIONS:"", PROMPT:""} +UI.BuiltIns = {DIR:"", DSELECTION:"", DSELECTIONS:"", HASH:"", + PROMPT:"", SELECTION:"", SELECTIONS:""} # Prepare storage for key bindings UI.KeyBindings = {}