parent
ca539102d7
commit
91ffeb9a4b
4
BUGS
4
BUGS
|
@ -1,3 +1,7 @@
|
|||
2007/07/12:
|
||||
sometimes searching seems to save the wrong cursor position, or not overwrite
|
||||
the previously used one.
|
||||
|
||||
2006/07/04:
|
||||
undo/redo should probably show you what is being undone (i.e. by jumping to that
|
||||
region of code).
|
||||
|
|
|
@ -117,12 +117,12 @@ class InsertSearchString(method.Method):
|
|||
w.insert_string_at_cursor(self.string)
|
||||
s = w.buffer.make_string()
|
||||
if not s:
|
||||
w.application.clear_highlighted_ranges()
|
||||
return
|
||||
else:
|
||||
s = w.buffer.make_string()
|
||||
w2 = w.buffer.method.old_window
|
||||
try:
|
||||
r = _make_regex(w, s)
|
||||
w2 = w.buffer.method.old_window
|
||||
if w.buffer.method.direction == 'next':
|
||||
search.find_next(r, w2, move=False)
|
||||
else:
|
||||
|
|
57
mode_sh.py
57
mode_sh.py
|
@ -3,31 +3,32 @@ from lex2 import Grammar, PatternRule, RegionRule
|
|||
|
||||
class StringGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule(name=r'escaped', pattern=r'\\.'),
|
||||
PatternRule(name=r'variable', pattern=r"(?:^|(?<= ))[a-zA-Z_][a-zA-Z_][a-zA-Z0-9_]*(?==)"),
|
||||
PatternRule(name=r'variable', pattern=r"\${(?:[a-zA-Z0-9_]+|\?\$)}"),
|
||||
PatternRule(name=r"variable", pattern=r"\$[^({][a-zA-Z0-9_]*"),
|
||||
PatternRule(name=r'variable', pattern=r"\$(?=\()"),
|
||||
PatternRule(r'escaped', r'\\.'),
|
||||
PatternRule(r'variable', r"\${(?:[a-zA-Z0-9_]+|\?\$)}"),
|
||||
PatternRule(r"variable", r"\$[^({][a-zA-Z0-9_]*"),
|
||||
PatternRule(r'variable', r"\$(?=\()"),
|
||||
]
|
||||
|
||||
class ShGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule(name=r'function', pattern=r'[a-zA-Z_][a-zA-Z0-9_]*(?= *\(\))'),
|
||||
PatternRule(name=r'reserved', pattern=r"(?:case|done|do|elif|else|esac|fi|for|function|if|in|select|then|until|while|time)(?![a-zA-Z0-9_=/])"),
|
||||
PatternRule(name=r'builtin', pattern=r"(?:source|alias|bg|bind|break|builtin|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|fc|fg|getops|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|readonly|read|return|set|shift|shopt|suspend|test|times|trap|type|ulimit|umask|unalias|unset|wait)(?![a-zA-Z0-9_=/])"),
|
||||
PatternRule(name=r'operator', pattern=r"(?:-eq|-ne|-gt|-lt|-ge|-le| = | != )"),
|
||||
PatternRule(name=r'delimiter', pattern=r"[][\(\);\{\}|&><]"),
|
||||
RegionRule(name=r'eval2', start=r'\$\(', grammar=None, end=r'\)'),
|
||||
PatternRule(name=r'variable', pattern=r"(?:^|(?<= ))[a-zA-Z_][a-zA-Z_][a-zA-Z0-9_]*(?==)"),
|
||||
PatternRule(name=r'variable', pattern=r"\${(?:[a-zA-Z0-9_]+|\?\$)}"),
|
||||
PatternRule(name=r"variable", pattern=r"\$[^({][a-zA-Z0-9_]*"),
|
||||
PatternRule(name=r'variable', pattern=r"\$(?=\()"),
|
||||
RegionRule(name=r'eval', start='`', grammar=StringGrammar(), end='`'),
|
||||
RegionRule(name=r'string', start="'", grammar=Grammar(), end="'"),
|
||||
RegionRule(name=r'string', start='"', grammar=StringGrammar(), end='"'),
|
||||
PatternRule(name=r'continuation', pattern=r'\\(?= *$)'),
|
||||
PatternRule(name=r'comment', pattern=r'#.*$'),
|
||||
PatternRule(name=r'bareword', pattern=r'[a-zA-Z0-9_-]+'),
|
||||
PatternRule(r'function', r'[a-zA-Z_][a-zA-Z0-9_]*(?= *\(\))'),
|
||||
PatternRule(r'reserved', r"(?:case|done|do|elif|else|esac|fi|for|function|if|in|select|then|until|while|time)(?![a-zA-Z0-9_=/])"),
|
||||
PatternRule(r'builtin', r"(?:source|alias|bg|bind|break|builtin|cd|command|compgen|complete|declare|dirs|disown|echo|enable|eval|exec|exit|export|fc|fg|getops|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|readonly|read|return|set|shift|shopt|suspend|test|times|trap|type|ulimit|umask|unalias|unset|wait)(?![a-zA-Z0-9_=/])"),
|
||||
PatternRule(r'operator', r"(?:-eq|-ne|-gt|-lt|-ge|-le| = | != )"),
|
||||
PatternRule(r'delimiter', r"[][\(\);\{\}|&><]"),
|
||||
RegionRule(r'eval', '`', StringGrammar, '`'),
|
||||
#RegionRule(r'eval2', r'\$\(', None, r'\)'),
|
||||
RegionRule(r'eval2', r'\$\(', StringGrammar, r'\)'),
|
||||
PatternRule(r'variable', r"(?:^|(?<= ))[a-zA-Z_][a-zA-Z_][a-zA-Z0-9_]*(?==)"),
|
||||
PatternRule(r'variable', r"\${(?:[a-zA-Z0-9_]+|\?\$)}"),
|
||||
PatternRule(r"variable", r"\$[^({][a-zA-Z0-9_]*"),
|
||||
PatternRule(r'variable', r"\$(?=\()"),
|
||||
RegionRule(r'string', "'", Grammar(), "'"),
|
||||
RegionRule(r'string', '"', StringGrammar, '"'),
|
||||
PatternRule(r'comment', r'#.*$'),
|
||||
PatternRule(r'bareword', r'[a-zA-Z0-9_-]+'),
|
||||
PatternRule(r'continuation', r'\\\n$'),
|
||||
PatternRule(r'eol', r'\n$'),
|
||||
]
|
||||
|
||||
class Sh(mode2.Fundamental):
|
||||
|
@ -39,19 +40,27 @@ class Sh(mode2.Fundamental):
|
|||
'function': color.build('magenta', 'default', 'bold'),
|
||||
'reserved': color.build('magenta', 'default', 'bold'),
|
||||
'variable': color.build('yellow', 'default', 'bold'),
|
||||
|
||||
'delimiter': color.build('default', 'default', 'bold'),
|
||||
'operator': color.build('magenta', 'default', 'bold'),
|
||||
'redirection': color.build('blue', 'default', 'bold'),
|
||||
|
||||
'string.start': color.build('green', 'default'),
|
||||
'string.variable': color.build('yellow', 'default'),
|
||||
'string.null': color.build('green', 'default'),
|
||||
'string.end': color.build('green', 'default'),
|
||||
|
||||
'eval.start': color.build('cyan', 'default'),
|
||||
'eval.variable': color.build('yellow', 'default'),
|
||||
'eval.null': color.build('cyan', 'default'),
|
||||
'eval.end': color.build('cyan', 'default'),
|
||||
'eval2.start': color.build('cyan', 'default'),
|
||||
'eval2.end': color.build('cyan', 'default'),
|
||||
|
||||
#'eval2.start': color.build('cyan', 'default'),
|
||||
#'eval2.end': color.build('cyan', 'default'),
|
||||
'eval2.start': color.build('yellow', 'default'),
|
||||
'eval2.variable': color.build('yellow', 'default'),
|
||||
'eval2.null': color.build('cyan', 'default'),
|
||||
'eval2.end': color.build('yellow', 'default'),
|
||||
|
||||
'comment': color.build('red', 'default'),
|
||||
'continuation': color.build('red', 'default'),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue