branch : pmacs2
This commit is contained in:
moculus 2007-07-12 21:42:31 +00:00
parent ca539102d7
commit 91ffeb9a4b
3 changed files with 39 additions and 26 deletions

4
BUGS
View File

@ -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: 2006/07/04:
undo/redo should probably show you what is being undone (i.e. by jumping to that undo/redo should probably show you what is being undone (i.e. by jumping to that
region of code). region of code).

View File

@ -117,12 +117,12 @@ class InsertSearchString(method.Method):
w.insert_string_at_cursor(self.string) w.insert_string_at_cursor(self.string)
s = w.buffer.make_string() s = w.buffer.make_string()
if not s: if not s:
w.application.clear_highlighted_ranges()
return return
else: else:
s = w.buffer.make_string()
w2 = w.buffer.method.old_window
try: try:
r = _make_regex(w, s) r = _make_regex(w, s)
w2 = w.buffer.method.old_window
if w.buffer.method.direction == 'next': if w.buffer.method.direction == 'next':
search.find_next(r, w2, move=False) search.find_next(r, w2, move=False)
else: else:

View File

@ -3,31 +3,32 @@ from lex2 import Grammar, PatternRule, RegionRule
class StringGrammar(Grammar): class StringGrammar(Grammar):
rules = [ rules = [
PatternRule(name=r'escaped', pattern=r'\\.'), PatternRule(r'escaped', r'\\.'),
PatternRule(name=r'variable', pattern=r"(?:^|(?<= ))[a-zA-Z_][a-zA-Z_][a-zA-Z0-9_]*(?==)"), PatternRule(r'variable', r"\${(?:[a-zA-Z0-9_]+|\?\$)}"),
PatternRule(name=r'variable', pattern=r"\${(?:[a-zA-Z0-9_]+|\?\$)}"), PatternRule(r"variable", r"\$[^({][a-zA-Z0-9_]*"),
PatternRule(name=r"variable", pattern=r"\$[^({][a-zA-Z0-9_]*"), PatternRule(r'variable', r"\$(?=\()"),
PatternRule(name=r'variable', pattern=r"\$(?=\()"),
] ]
class ShGrammar(Grammar): class ShGrammar(Grammar):
rules = [ rules = [
PatternRule(name=r'function', pattern=r'[a-zA-Z_][a-zA-Z0-9_]*(?= *\(\))'), PatternRule(r'function', 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(r'reserved', 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(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(name=r'operator', pattern=r"(?:-eq|-ne|-gt|-lt|-ge|-le| = | != )"), PatternRule(r'operator', r"(?:-eq|-ne|-gt|-lt|-ge|-le| = | != )"),
PatternRule(name=r'delimiter', pattern=r"[][\(\);\{\}|&><]"), PatternRule(r'delimiter', r"[][\(\);\{\}|&><]"),
RegionRule(name=r'eval2', start=r'\$\(', grammar=None, end=r'\)'), RegionRule(r'eval', '`', StringGrammar, '`'),
PatternRule(name=r'variable', pattern=r"(?:^|(?<= ))[a-zA-Z_][a-zA-Z_][a-zA-Z0-9_]*(?==)"), #RegionRule(r'eval2', r'\$\(', None, r'\)'),
PatternRule(name=r'variable', pattern=r"\${(?:[a-zA-Z0-9_]+|\?\$)}"), RegionRule(r'eval2', r'\$\(', StringGrammar, r'\)'),
PatternRule(name=r"variable", pattern=r"\$[^({][a-zA-Z0-9_]*"), PatternRule(r'variable', r"(?:^|(?<= ))[a-zA-Z_][a-zA-Z_][a-zA-Z0-9_]*(?==)"),
PatternRule(name=r'variable', pattern=r"\$(?=\()"), PatternRule(r'variable', r"\${(?:[a-zA-Z0-9_]+|\?\$)}"),
RegionRule(name=r'eval', start='`', grammar=StringGrammar(), end='`'), PatternRule(r"variable", r"\$[^({][a-zA-Z0-9_]*"),
RegionRule(name=r'string', start="'", grammar=Grammar(), end="'"), PatternRule(r'variable', r"\$(?=\()"),
RegionRule(name=r'string', start='"', grammar=StringGrammar(), end='"'), RegionRule(r'string', "'", Grammar(), "'"),
PatternRule(name=r'continuation', pattern=r'\\(?= *$)'), RegionRule(r'string', '"', StringGrammar, '"'),
PatternRule(name=r'comment', pattern=r'#.*$'), PatternRule(r'comment', r'#.*$'),
PatternRule(name=r'bareword', pattern=r'[a-zA-Z0-9_-]+'), PatternRule(r'bareword', r'[a-zA-Z0-9_-]+'),
PatternRule(r'continuation', r'\\\n$'),
PatternRule(r'eol', r'\n$'),
] ]
class Sh(mode2.Fundamental): class Sh(mode2.Fundamental):
@ -39,19 +40,27 @@ class Sh(mode2.Fundamental):
'function': color.build('magenta', 'default', 'bold'), 'function': color.build('magenta', 'default', 'bold'),
'reserved': color.build('magenta', 'default', 'bold'), 'reserved': color.build('magenta', 'default', 'bold'),
'variable': color.build('yellow', 'default', 'bold'), 'variable': color.build('yellow', 'default', 'bold'),
'delimiter': color.build('default', 'default', 'bold'), 'delimiter': color.build('default', 'default', 'bold'),
'operator': color.build('magenta', 'default', 'bold'), 'operator': color.build('magenta', 'default', 'bold'),
'redirection': color.build('blue', 'default', 'bold'),
'string.start': color.build('green', 'default'), 'string.start': color.build('green', 'default'),
'string.variable': color.build('yellow', 'default'), 'string.variable': color.build('yellow', 'default'),
'string.null': color.build('green', 'default'), 'string.null': color.build('green', 'default'),
'string.end': color.build('green', 'default'), 'string.end': color.build('green', 'default'),
'eval.start': color.build('cyan', 'default'), 'eval.start': color.build('cyan', 'default'),
'eval.variable': color.build('yellow', 'default'), 'eval.variable': color.build('yellow', 'default'),
'eval.null': color.build('cyan', 'default'), 'eval.null': color.build('cyan', 'default'),
'eval.end': 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'), 'comment': color.build('red', 'default'),
'continuation': color.build('red', 'default'), 'continuation': color.build('red', 'default'),
} }