fixed python tabbing, readded case insensitivity to literal searches
--HG-- branch : pmacs2
This commit is contained in:
parent
1dd0f520ec
commit
085e2e2f9e
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue