some fixes for searching bugs

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-09-26 04:32:28 +00:00
parent faf00c2db6
commit 025d142a3d
4 changed files with 8 additions and 13 deletions

1
BUGS
View File

@ -15,6 +15,7 @@ reverse search is all fucked up.
2007/07/15:
sometimes you don't get search-as-you-type (and have to hit C-s an extra time
to see anything).
* possibly fixed (2007/09/26)
2007/07/12:
sometimes searching seems to save the wrong cursor position, or not overwrite

View File

@ -137,8 +137,8 @@ class ForwardLines(Method):
# search and replace
class Search(Method):
'''Interactive search; finds next occurance of text in buffer'''
direction = 'next'
is_literal = True
direction = 'next'
prompt = 'I-Search: '
def execute(self, w, **vargs):
self.old_cursor = w.logical_cursor()

View File

@ -36,7 +36,10 @@ def _make_regex(w, s):
try:
if w.buffer.method.is_literal:
s = searchutil.escape_literal(s)
return re.compile(s, re.IGNORECASE)
if s.islower():
return re.compile(s, re.IGNORECASE)
else:
return re.compile(s)
else:
return re.compile(s)
except:
@ -53,7 +56,8 @@ class SearchNext(method.Method):
except searchutil.IllegalPatternError:
w.application.clear_highlighted_ranges()
else:
w.buffer.set_data(w.application.last_search)
action = InsertSearchString(w.application.last_search)
action.execute(w)
class SearchPrevious(method.Method):
def execute(self, w, **vargs):
@ -136,5 +140,3 @@ def _end(w):
w.application.close_mini_buffer()
w.application.clear_highlighted_ranges()
w.application.last_search = w.buffer.make_string()
#w.buffer.method.old_cursor = None
#w.buffer.method.old_window = None

View File

@ -38,14 +38,9 @@ class TestGrammar(Grammar):
class ShGrammar(Grammar):
rules = [
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'reserved', r"(?:done|do|elif|else|esac|fi|for|function|if|in|select|then|until|while|time)(?![a-zA-Z0-9_=/])"),
RegionRule(r'case', r'case', Grammar, 'in', CaseGrammar, r'esac'),
#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'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|times|trap|type|ulimit|umask|unalias|unset|wait)(?![a-zA-Z0-9_=/])"),
#PatternRule(r'operator', r"(?:-eq|-ne|-gt|-lt|-ge|-le| = | != )(?![a-zA-Z0-9_])"),
#PatternRule(r'delimiter', r";;|[\[\]\(\);\{\}|&><]"),
#RegionRule(r'test', r'\[', TestGrammar, r'\]'),
RegionRule(r'test', r'test', TestGrammar, r'\n'),
RegionRule(r'test2', r'\[', TestGrammar, r'\]'),
PatternRule(r'delimiter', r";;|[();{}|&><]"),
@ -94,7 +89,6 @@ class Sh(mode2.Fundamental):
grammar = ShGrammar
tabbercls = ShTabber
opentokens = ('delimiter', 'reserved', 'case.start')
#opentokens = ('delimiter', 'reserved', 'start')
opentags = {'(': ')', '[': ']', '{': '}',
'do': 'done', 'then': 'fi', 'case': 'esac'}
closetokens = ('delimiter', 'reserved', 'case.end')
@ -127,8 +121,6 @@ class Sh(mode2.Fundamental):
'eval.null': ('cyan', 'default'),
'eval.end': ('cyan', 'default'),
#'neval.start': ('cyan', 'default'),
#'neval.end': ('cyan', 'default'),
'neval.start': ('yellow', 'default'),
'neval.variable': ('yellow', 'default'),
'neval.null': ('cyan', 'default'),