parent
0b9640b05f
commit
36d363c7bd
|
@ -58,6 +58,7 @@ class Buffer(object):
|
||||||
self.nl = nl
|
self.nl = nl
|
||||||
self.modified = False
|
self.modified = False
|
||||||
self.highlights = {}
|
self.highlights = {}
|
||||||
|
self.indentlvl = 4
|
||||||
|
|
||||||
# basic file operation stuff
|
# basic file operation stuff
|
||||||
def _open_file_r(self, path):
|
def _open_file_r(self, path):
|
||||||
|
|
|
@ -261,10 +261,10 @@ class DeleteRight(Method):
|
||||||
'''Delete the character under the cursor'''
|
'''Delete the character under the cursor'''
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
cursor = w.logical_cursor()
|
cursor = w.logical_cursor()
|
||||||
line = w.buffer.lines[cursor.y]
|
line = w.buffer.lines[cursor.y]
|
||||||
if len(line[cursor.x:]) >= 4 and line[:cursor.x + 4].isspace():
|
lvl = w.mode.tabwidth
|
||||||
w.kill(Point(cursor.x, cursor.y),
|
if len(line[cursor.x:]) >= lvl and line[:cursor.x + lvl].isspace():
|
||||||
Point(cursor.x + 4, cursor.y))
|
w.kill(Point(cursor.x, cursor.y), Point(cursor.x + lvl, cursor.y))
|
||||||
else:
|
else:
|
||||||
w.right_delete()
|
w.right_delete()
|
||||||
class DeleteLeftWord(Method):
|
class DeleteLeftWord(Method):
|
||||||
|
@ -723,8 +723,9 @@ class Redo(Method):
|
||||||
w.set_error("%s" % (e))
|
w.set_error("%s" % (e))
|
||||||
|
|
||||||
class UnindentBlock(Method):
|
class UnindentBlock(Method):
|
||||||
'''Prepend 4 spaces to each line in region'''
|
'''Prepend a tab of space to each line in region'''
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
|
lvl = w.mode.tabwidth
|
||||||
cursor = w.logical_cursor()
|
cursor = w.logical_cursor()
|
||||||
if cursor < w.mark:
|
if cursor < w.mark:
|
||||||
p1 = cursor
|
p1 = cursor
|
||||||
|
@ -738,11 +739,11 @@ class UnindentBlock(Method):
|
||||||
lines = w.buffer.lines[p1.y:p2.y]
|
lines = w.buffer.lines[p1.y:p2.y]
|
||||||
for i in range(0, len(lines)):
|
for i in range(0, len(lines)):
|
||||||
if lines[i].startswith(' '):
|
if lines[i].startswith(' '):
|
||||||
lines[i] = lines[i][4:]
|
lines[i] = lines[i][lvl:]
|
||||||
w.buffer.delete(Point(0, p1.y), Point(0, p2.y))
|
w.buffer.delete(Point(0, p1.y), Point(0, p2.y))
|
||||||
w.buffer.insert_string(Point(0, p1.y), '\n'.join(lines) + '\n')
|
w.buffer.insert_string(Point(0, p1.y), '\n'.join(lines) + '\n')
|
||||||
class IndentBlock(Method):
|
class IndentBlock(Method):
|
||||||
'''Add 4 spaces to each line in region'''
|
'''Prepend a tab of space to each line in region'''
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
cursor = w.logical_cursor()
|
cursor = w.logical_cursor()
|
||||||
if cursor < w.mark:
|
if cursor < w.mark:
|
||||||
|
@ -954,3 +955,9 @@ class SetConfigVariable(Method):
|
||||||
w.set_error("param %r set to %r" % (name, value))
|
w.set_error("param %r set to %r" % (name, value))
|
||||||
else:
|
else:
|
||||||
w.set_error("previously unset param %r set to %r" % (name, value))
|
w.set_error("previously unset param %r set to %r" % (name, value))
|
||||||
|
|
||||||
|
class SetTabWidth(Method):
|
||||||
|
args = [arg('width', t=type(0), p="Tab Width: ", h='New tab width for buffer')]
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
w.mode.tabwidth = vargs['width']
|
||||||
|
w.set_error('Tab width set to %d' % w.mode.tabwidth)
|
||||||
|
|
12
mode/c.py
12
mode/c.py
|
@ -104,6 +104,7 @@ class CTabber(tab.StackTabber):
|
||||||
tab.StackTabber._handle_open_token(self, currlvl, y, i)
|
tab.StackTabber._handle_open_token(self, currlvl, y, i)
|
||||||
return currlvl
|
return currlvl
|
||||||
def _handle_close_token(self, currlvl, y, i):
|
def _handle_close_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
self._opt_pop('cont')
|
self._opt_pop('cont')
|
||||||
currlvl = tab.StackTabber._handle_close_token(self, currlvl, y, i)
|
currlvl = tab.StackTabber._handle_close_token(self, currlvl, y, i)
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
|
@ -115,9 +116,10 @@ class CTabber(tab.StackTabber):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if token.fqname() != 'macro.delimiter':
|
if token.fqname() != 'macro.delimiter':
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
return currlvl
|
return currlvl
|
||||||
def _handle_other_token(self, currlvl, y, i):
|
def _handle_other_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
fqname = token.fqname()
|
fqname = token.fqname()
|
||||||
if fqname == 'delimiter' and token.string == ';':
|
if fqname == 'delimiter' and token.string == ';':
|
||||||
|
@ -128,7 +130,7 @@ class CTabber(tab.StackTabber):
|
||||||
|
|
||||||
elif fqname == 'keyword':
|
elif fqname == 'keyword':
|
||||||
if token.string in ('do', 'else', 'for', 'if', 'while'):
|
if token.string in ('do', 'else', 'for', 'if', 'while'):
|
||||||
self._append('cond', currlvl + 4)
|
self._append('cond', currlvl + w)
|
||||||
elif token.string == 'break':
|
elif token.string == 'break':
|
||||||
self._opt_pop('case', 'while', 'for')
|
self._opt_pop('case', 'while', 'for')
|
||||||
elif token.string == 'continue':
|
elif token.string == 'continue':
|
||||||
|
@ -136,14 +138,14 @@ class CTabber(tab.StackTabber):
|
||||||
elif token.string == 'case':
|
elif token.string == 'case':
|
||||||
self._opt_pop('case')
|
self._opt_pop('case')
|
||||||
currlvl = self.get_curr_level()
|
currlvl = self.get_curr_level()
|
||||||
self._opt_append('case', currlvl + 4)
|
self._opt_append('case', currlvl + w)
|
||||||
|
|
||||||
elif fqname == 'string.start':
|
elif fqname == 'string.start':
|
||||||
self._opt_append('string', None)
|
self._opt_append('string', None)
|
||||||
elif fqname == 'string.end':
|
elif fqname == 'string.end':
|
||||||
self._opt_pop('string')
|
self._opt_pop('string')
|
||||||
if self.is_rightmost_token(y, i):
|
if self.is_rightmost_token(y, i):
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
|
|
||||||
# TODO: this could be a lot better
|
# TODO: this could be a lot better
|
||||||
elif fqname == 'macro':
|
elif fqname == 'macro':
|
||||||
|
@ -172,7 +174,7 @@ class CTabber(tab.StackTabber):
|
||||||
not fqname == 'spaces' and
|
not fqname == 'spaces' and
|
||||||
not fqname == 'eol' and
|
not fqname == 'eol' and
|
||||||
token.string not in ('}', ';', '(', '{', '[', ',')):
|
token.string not in ('}', ';', '(', '{', '[', ',')):
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class C(mode.Fundamental):
|
class C(mode.Fundamental):
|
||||||
|
|
12
mode/java.py
12
mode/java.py
|
@ -85,6 +85,7 @@ class JavaTabber(CTabber):
|
||||||
currlvl = tab.StackTabber._handle_open_token(self, currlvl, y, i)
|
currlvl = tab.StackTabber._handle_open_token(self, currlvl, y, i)
|
||||||
return currlvl
|
return currlvl
|
||||||
def _handle_close_token(self, currlvl, y, i):
|
def _handle_close_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
self._opt_pop('cont')
|
self._opt_pop('cont')
|
||||||
currlvl = tab.StackTabber._handle_close_token(self, currlvl, y, i)
|
currlvl = tab.StackTabber._handle_close_token(self, currlvl, y, i)
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
|
@ -95,9 +96,10 @@ class JavaTabber(CTabber):
|
||||||
elif self._peek_name() == 'cond':
|
elif self._peek_name() == 'cond':
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
return currlvl
|
return currlvl
|
||||||
def _handle_other_token(self, currlvl, y, i):
|
def _handle_other_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
fqname = token.fqname()
|
fqname = token.fqname()
|
||||||
if fqname == 'delimiter' and token.string == ';':
|
if fqname == 'delimiter' and token.string == ';':
|
||||||
|
@ -107,7 +109,7 @@ class JavaTabber(CTabber):
|
||||||
|
|
||||||
elif fqname == 'keyword':
|
elif fqname == 'keyword':
|
||||||
if token.string in ('do', 'else', 'for', 'if', 'while'):
|
if token.string in ('do', 'else', 'for', 'if', 'while'):
|
||||||
self._append('cond', currlvl + 4)
|
self._append('cond', currlvl + w)
|
||||||
elif token.string == 'break':
|
elif token.string == 'break':
|
||||||
self._opt_pop('case', 'while', 'for')
|
self._opt_pop('case', 'while', 'for')
|
||||||
elif token.string == 'continue':
|
elif token.string == 'continue':
|
||||||
|
@ -115,14 +117,14 @@ class JavaTabber(CTabber):
|
||||||
elif token.string == 'case':
|
elif token.string == 'case':
|
||||||
self._opt_pop('case')
|
self._opt_pop('case')
|
||||||
currlvl = self.get_curr_level()
|
currlvl = self.get_curr_level()
|
||||||
self._opt_append('case', currlvl + 4)
|
self._opt_append('case', currlvl + w)
|
||||||
|
|
||||||
elif fqname == 'string.start':
|
elif fqname == 'string.start':
|
||||||
self._opt_append('string', None)
|
self._opt_append('string', None)
|
||||||
elif fqname == 'string.end':
|
elif fqname == 'string.end':
|
||||||
self._opt_pop('string')
|
self._opt_pop('string')
|
||||||
if self.is_rightmost_token(y, i):
|
if self.is_rightmost_token(y, i):
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
|
|
||||||
# TODO: this could be a lot better
|
# TODO: this could be a lot better
|
||||||
elif fqname == 'macro':
|
elif fqname == 'macro':
|
||||||
|
@ -150,7 +152,7 @@ class JavaTabber(CTabber):
|
||||||
not fqname == 'null' and
|
not fqname == 'null' and
|
||||||
not fqname == 'eol' and
|
not fqname == 'eol' and
|
||||||
token.string not in ('}', ';', '(', '{', '[', ',')):
|
token.string not in ('}', ';', '(', '{', '[', ',')):
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Java(mode.Fundamental):
|
class Java(mode.Fundamental):
|
||||||
|
|
|
@ -44,10 +44,11 @@ class JavascriptTabber(tab.StackTabber):
|
||||||
t = highlighter.tokens[y][0]
|
t = highlighter.tokens[y][0]
|
||||||
return t.name == 'reserved' and t.string == 'function'
|
return t.name == 'reserved' and t.string == 'function'
|
||||||
def _handle_other_token(self, currlvl, y, i):
|
def _handle_other_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
fqname = token.fqname()
|
fqname = token.fqname()
|
||||||
if token.name == 'operator' and token.string == '=':
|
if token.name == 'operator' and token.string == '=':
|
||||||
self._opt_append("cont", currlvl + 4)
|
self._opt_append("cont", currlvl + w)
|
||||||
elif token.name == 'delimiter' and token.string == ";":
|
elif token.name == 'delimiter' and token.string == ";":
|
||||||
self._opt_pop("cont")
|
self._opt_pop("cont")
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
10
mode/perl.py
10
mode/perl.py
|
@ -142,6 +142,7 @@ class PerlTabber(tab.StackTabber):
|
||||||
currlvl = tab.StackTabber._handle_open_token(self, currlvl, y, i)
|
currlvl = tab.StackTabber._handle_open_token(self, currlvl, y, i)
|
||||||
return currlvl
|
return currlvl
|
||||||
def _handle_close_token(self, currlvl, y, i):
|
def _handle_close_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
self._opt_pop('cont')
|
self._opt_pop('cont')
|
||||||
currlvl = tab.StackTabber._handle_close_token(self, currlvl, y, i)
|
currlvl = tab.StackTabber._handle_close_token(self, currlvl, y, i)
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
|
@ -149,9 +150,10 @@ class PerlTabber(tab.StackTabber):
|
||||||
if token.string == '}':
|
if token.string == '}':
|
||||||
self._opt_pop('cont')
|
self._opt_pop('cont')
|
||||||
else:
|
else:
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
return currlvl
|
return currlvl
|
||||||
def _handle_other_token(self, currlvl, y, i):
|
def _handle_other_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
fqname = token.fqname()
|
fqname = token.fqname()
|
||||||
if fqname == 'delimiter' and token.string == ';':
|
if fqname == 'delimiter' and token.string == ';':
|
||||||
|
@ -162,7 +164,7 @@ class PerlTabber(tab.StackTabber):
|
||||||
self._opt_pop('heredoc')
|
self._opt_pop('heredoc')
|
||||||
self._opt_pop('cont')
|
self._opt_pop('cont')
|
||||||
elif fqname == 'quoted.start':
|
elif fqname == 'quoted.start':
|
||||||
self._opt_append('quoted', currlvl + 4)
|
self._opt_append('quoted', currlvl + w)
|
||||||
elif fqname == 'quoted.end':
|
elif fqname == 'quoted.end':
|
||||||
self._opt_pop('cont')
|
self._opt_pop('cont')
|
||||||
self._opt_pop('quoted')
|
self._opt_pop('quoted')
|
||||||
|
@ -181,7 +183,7 @@ class PerlTabber(tab.StackTabber):
|
||||||
elif fqname == 'perl_string.end':
|
elif fqname == 'perl_string.end':
|
||||||
self._opt_pop('string')
|
self._opt_pop('string')
|
||||||
if self.is_rightmost_token(y, i):
|
if self.is_rightmost_token(y, i):
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
if self.is_rightmost_token(y, i):
|
if self.is_rightmost_token(y, i):
|
||||||
if(not fqname.startswith('pod') and
|
if(not fqname.startswith('pod') and
|
||||||
not fqname.startswith('heredoc') and
|
not fqname.startswith('heredoc') and
|
||||||
|
@ -191,7 +193,7 @@ class PerlTabber(tab.StackTabber):
|
||||||
not fqname == 'comment' and
|
not fqname == 'comment' and
|
||||||
not fqname == 'null' and
|
not fqname == 'null' and
|
||||||
token.string not in ('}', ';', '(', '{', '[', ',')):
|
token.string not in ('}', ';', '(', '{', '[', ',')):
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Perl(mode.Fundamental):
|
class Perl(mode.Fundamental):
|
||||||
|
|
|
@ -124,6 +124,7 @@ class PythonTabber(tab.StackTabber):
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
def _handle_other_token(self, currlvl, y, i):
|
def _handle_other_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
fqname = token.fqname()
|
fqname = token.fqname()
|
||||||
if fqname == 'continuation':
|
if fqname == 'continuation':
|
||||||
|
@ -132,7 +133,7 @@ class PythonTabber(tab.StackTabber):
|
||||||
if self.continued:
|
if self.continued:
|
||||||
self._opt_append('cont', currlvl)
|
self._opt_append('cont', currlvl)
|
||||||
else:
|
else:
|
||||||
self._opt_append('cont', currlvl + 4)
|
self._opt_append('cont', currlvl + w)
|
||||||
elif fqname == 'string.start':
|
elif fqname == 'string.start':
|
||||||
# while inside of a string, there is no indention leve
|
# while inside of a string, there is no indention leve
|
||||||
self._opt_append('string', None)
|
self._opt_append('string', None)
|
||||||
|
@ -157,25 +158,25 @@ class PythonTabber(tab.StackTabber):
|
||||||
self.popped = True
|
self.popped = True
|
||||||
elif token.string in self.startlevel_names and self.is_leftmost_token(y, i):
|
elif token.string in self.startlevel_names and self.is_leftmost_token(y, i):
|
||||||
# we know we will indent exactly once
|
# we know we will indent exactly once
|
||||||
self._append(token.string, currlvl + 4)
|
self._append(token.string, currlvl + w)
|
||||||
elif token.string in ('elif', 'else') and self.is_leftmost_token(y, i):
|
elif token.string in ('elif', 'else') and self.is_leftmost_token(y, i):
|
||||||
# we know we'll unindent at least to the first if/elif
|
# we know we'll unindent at least to the first if/elif
|
||||||
if not self.popped and not self.last_popped:
|
if not self.popped and not self.last_popped:
|
||||||
self._pop_until('if', 'elif')
|
self._pop_until('if', 'elif')
|
||||||
currlvl = self.get_curr_level()
|
currlvl = self.get_curr_level()
|
||||||
self._append(token.string, currlvl + 4)
|
self._append(token.string, currlvl + w)
|
||||||
elif token.string == 'except' and self.is_leftmost_token(y, i):
|
elif token.string == 'except' and self.is_leftmost_token(y, i):
|
||||||
# we know we'll unindent at least to the first try
|
# we know we'll unindent at least to the first try
|
||||||
if not self.popped and not self.last_popped:
|
if not self.popped and not self.last_popped:
|
||||||
self._pop_until('try')
|
self._pop_until('try')
|
||||||
currlvl = self.get_curr_level()
|
currlvl = self.get_curr_level()
|
||||||
self._append(token.string, currlvl + 4)
|
self._append(token.string, currlvl + w)
|
||||||
elif token.string == 'finally' and self.is_leftmost_token(y, i):
|
elif token.string == 'finally' and self.is_leftmost_token(y, i):
|
||||||
# we know we'll unindent at least to the first try/except
|
# we know we'll unindent at least to the first try/except
|
||||||
if not self.popped and not self.last_popped:
|
if not self.popped and not self.last_popped:
|
||||||
self._pop_until('try', 'except')
|
self._pop_until('try', 'except')
|
||||||
currlvl = self.get_curr_level()
|
currlvl = self.get_curr_level()
|
||||||
self._append(token.string, currlvl + 4)
|
self._append(token.string, currlvl + w)
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
||||||
class Python(mode.Fundamental):
|
class Python(mode.Fundamental):
|
||||||
|
|
|
@ -93,12 +93,13 @@ class ShTabber(tab.StackTabber):
|
||||||
else:
|
else:
|
||||||
return tab.StackTabber._handle_close_token(self, currlvl, y, i)
|
return tab.StackTabber._handle_close_token(self, currlvl, y, i)
|
||||||
def _handle_other_token(self, currlvl, y, i):
|
def _handle_other_token(self, currlvl, y, i):
|
||||||
|
w = self.mode.tabwidth
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
fqname = token.fqname()
|
fqname = token.fqname()
|
||||||
if token.name == 'continuation':
|
if token.name == 'continuation':
|
||||||
self._opt_append("cont", currlvl + 4)
|
self._opt_append("cont", currlvl + w)
|
||||||
elif token.name == 'sh_reserved' and token.string == 'else':
|
elif token.name == 'sh_reserved' and token.string == 'else':
|
||||||
currlvl -= 4
|
currlvl -= w
|
||||||
elif token.name == 'eol':
|
elif token.name == 'eol':
|
||||||
self._opt_pop("cont")
|
self._opt_pop("cont")
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
17
mode/sql.py
17
mode/sql.py
|
@ -74,15 +74,16 @@ class SqlTabber(tab.StackTabber):
|
||||||
t = highlighter.tokens[y][0]
|
t = highlighter.tokens[y][0]
|
||||||
return t.name == 'function'
|
return t.name == 'function'
|
||||||
def _handle_other_token(self, currlvl, y, i):
|
def _handle_other_token(self, currlvl, y, i):
|
||||||
token = self.get_token(y, i)
|
w = self.mode.tabwidth
|
||||||
s = token.string.lower()
|
token = self.get_token(y, i)
|
||||||
|
s = token.string.lower()
|
||||||
if token.name == 'delimiter' and s == ';':
|
if token.name == 'delimiter' and s == ';':
|
||||||
self._opt_pop('cont')
|
self._opt_pop('cont')
|
||||||
elif token.name == 'sql_keyword':
|
elif token.name == 'sql_keyword':
|
||||||
if s == 'declare':
|
if s == 'declare':
|
||||||
self._append('declare', currlvl + 4)
|
self._append('declare', currlvl + w)
|
||||||
elif s == 'begin':
|
elif s == 'begin':
|
||||||
currlvl -= 4
|
currlvl -= w
|
||||||
elif s == 'end':
|
elif s == 'end':
|
||||||
self._opt_pop('declare')
|
self._opt_pop('declare')
|
||||||
currlvl = self.get_curr_level()
|
currlvl = self.get_curr_level()
|
||||||
|
@ -93,15 +94,15 @@ class SqlTabber(tab.StackTabber):
|
||||||
self._opt_pop('loop')
|
self._opt_pop('loop')
|
||||||
currlvl = self.get_curr_level()
|
currlvl = self.get_curr_level()
|
||||||
elif s == 'else':
|
elif s == 'else':
|
||||||
currlvl -= 4
|
currlvl -= w
|
||||||
elif s == 'if':
|
elif s == 'if':
|
||||||
self._append('if', currlvl + 4)
|
self._append('if', currlvl + w)
|
||||||
elif s in ('while', 'for'):
|
elif s in ('while', 'for'):
|
||||||
self._append('loop', currlvl + 4)
|
self._append('loop', currlvl + w)
|
||||||
|
|
||||||
if self.is_rightmost_token(y, i):
|
if self.is_rightmost_token(y, i):
|
||||||
if not self._empty() and token.name == 'continuation':
|
if not self._empty() and token.name == 'continuation':
|
||||||
self._append('cont', currlvl + 4)
|
self._append('cont', currlvl + w)
|
||||||
elif token.name == 'eol' and not self.markers:
|
elif token.name == 'eol' and not self.markers:
|
||||||
self._opt_pop("cont")
|
self._opt_pop("cont")
|
||||||
return currlvl
|
return currlvl
|
||||||
|
|
1
tab.py
1
tab.py
|
@ -155,7 +155,6 @@ class StackTabber(Tabber):
|
||||||
token = self.get_token(y, i)
|
token = self.get_token(y, i)
|
||||||
rtoken = self.get_next_right_token(y, i)
|
rtoken = self.get_next_right_token(y, i)
|
||||||
if rtoken is None:
|
if rtoken is None:
|
||||||
#level = self.get_curr_level() + 4
|
|
||||||
level = self.get_curr_level() + self.mode.tabwidth
|
level = self.get_curr_level() + self.mode.tabwidth
|
||||||
else:
|
else:
|
||||||
level = rtoken.x
|
level = rtoken.x
|
||||||
|
|
Loading…
Reference in New Issue