diff --git a/mode_python.py b/mode_python.py index 76f385e..eada39a 100644 --- a/mode_python.py +++ b/mode_python.py @@ -38,7 +38,7 @@ class PythonGrammar(Grammar): ] class PythonTabber(tab2.StackTabber): - #endlevel_names = ('pass', 'return', 'yield', 'raise', 'break', 'continue') + # NOTE: yield might initially seem like an endlevel name, but it's not one. endlevel_names = ('pass', 'return', 'raise', 'break', 'continue') startlevel_names = ('if', 'try', 'class', 'def', 'for', 'while', 'try') def __init__(self, m): @@ -50,11 +50,8 @@ class PythonTabber(tab2.StackTabber): # we always know that line 0 is indented at the 0 level return True tokens = self.get_tokens(y) - #if not tokens: - # # if a line has no tokens, we don't know much about its indentation - # return False - #elif tokens[0].name in self.startlevel_names: - if tokens[0].name in self.startlevel_names: + t0 = tokens[0] + if t0.name == 'keyword' and t0.string in self.startlevel_names: # if a line has no whitespace and beings with something like # 'while','class','def','if',etc. then we can start at it return True diff --git a/mode_search.py b/mode_search.py index 1646c8c..56e10f4 100644 --- a/mode_search.py +++ b/mode_search.py @@ -36,7 +36,9 @@ def _make_regex(w, s): try: if w.buffer.method.is_literal: s = search.escape_literal(s) - return re.compile(s) + return re.compile(s, re.IGNORECASE) + else: + return re.compile(s) except: raise search.IllegalPatternError, "failed to compile: %r" % s @@ -134,5 +136,5 @@ 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 + #w.buffer.method.old_cursor = None + #w.buffer.method.old_window = None