fix python tabbing

--HG--
branch : pmacs2
This commit is contained in:
~d6 2020-09-02 10:51:36 -04:00
parent 13a4637c42
commit 2c52dd6a1a
1 changed files with 5 additions and 3 deletions

View File

@ -119,6 +119,8 @@ class PythonTabber(tab.StackTabber):
self.popped = False
tokens = self.get_tokens(y)
currlvl = self.get_curr_level()
#if currlvl is None:
# raise Exception("damn: %r" % [(m, m.level) for m in self.markers])
# if we were continuing, let's pop that previous continuation token
# and note that we're continuing
if self.markers and self.markers[-1].name == 'cont':
@ -131,7 +133,7 @@ class PythonTabber(tab.StackTabber):
l = len(tokens[0].string)
else:
l = 0
while currlvl > l:
while currlvl is not None and currlvl > l:
self._pop()
currlvl = self.get_curr_level()
self.popped = True
@ -162,7 +164,7 @@ class PythonTabber(tab.StackTabber):
else:
self._opt_append('cont', currlvl + w, y)
elif fqname == 'string.start':
# while inside of a string, there is no indention leve
# while inside of a string, there is no indention level
self._opt_append('string', None, y)
elif fqname == 'string.end':
# since we're done with the string, resume our indentation level
@ -686,7 +688,7 @@ class Python(mode.Fundamental):
i -= 1
if marker.y == y:
continue
if ws and marker.level > ws:
if ws and marker.level is not None and marker.level > ws:
continue
s = w.buffer.lines[marker.y][:w.width - 1]
hs.insert(0, [RenderString(s=s, attrs=color.build(fg, bg))])