make indenting with tabs work better

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2010-07-03 23:33:05 -04:00
parent dd37bf139b
commit 7dac9a1984
3 changed files with 10 additions and 6 deletions

View File

@ -99,7 +99,9 @@ class GetToken(Method):
if token is None:
w.set_error('No Token')
else:
w.set_error('Token: %r (%s)' % (token.string, token.fqname()))
# HACK: fix up our internal tab representation
s = regex.internal_tab.sub('\t', token.string)
w.set_error('Token: %s (%s)' % (repr(s)[1:], token.fqname()))
class TokenComplete(Method):
'''Complete token names based on other tokens in the buffer'''

View File

@ -16,11 +16,12 @@ meta_chars = re.compile(r'([\.\^\$\*\+\?\{\}\(\)\[\]\|\"\'\\,])')
shell_command = re.compile(r'^[^ ]+')
# whitespace regexes
leading_whitespace = re.compile('^ *')
trailing_whitespace = re.compile(' *$')
whitespace = re.compile(r'^[ \n]*$')
leading_whitespace = re.compile('^[ \t]*')
trailing_whitespace = re.compile(r'[ \t]*$')
whitespace = re.compile(r'^[ \t\n]*$')
space = re.compile('^ *$')
leading_whitespace2 = re.compile('^( *?)(.*?)\n?$')
leading_whitespace2 = re.compile(r'^([ \t]*?)(.*?)\n?$')
internal_tab = re.compile(r'\t *\t')
# word regexes
word = re.compile('^[A-Za-z0-9_]+$')

3
tab.py
View File

@ -12,7 +12,8 @@ class Marker(object):
class Tabber(object):
wsre = regex.whitespace
wst = ('spaces', 'null', 'eol',)
sre = regex.space
#sre = regex.space
sre = regex.whitespace
st = ('spaces', 'null',)
def __init__(self, m):
self.mode = m