slightly improve tab support (as well as adding an *Exception* buffer for app exception)
--HG-- branch : pmacs2
This commit is contained in:
parent
479e64d1e0
commit
20c095b6c6
|
@ -318,7 +318,8 @@ class Application(object):
|
|||
lines = list(candidates)
|
||||
data = '\n'.join(lines)
|
||||
|
||||
b = self.data_buffer("*Completions*", data, switch_to=False)
|
||||
b = self.data_buffer("*Completions*", data, switch_to=False)
|
||||
|
||||
b._completion = s
|
||||
b._opened = opened
|
||||
b._previous = previous
|
||||
|
|
|
@ -490,14 +490,25 @@ class InsertTab(Method):
|
|||
|
||||
# if no lvl, insert a literal tab
|
||||
if lvl is None:
|
||||
w.insert_string_at_cursor(' ' * w.mode.tabwidth)
|
||||
#w.insert_string_at_cursor(' ' * w.mode.tabwidth)
|
||||
if w.buffer.usetabs:
|
||||
# see HACK in buffer
|
||||
w.insert_string_at_cursor('\t \t')
|
||||
else:
|
||||
w.insert_string_at_cursor(' ' * w.mode.tabwidth)
|
||||
return
|
||||
|
||||
# insert the correct amount of whitespace
|
||||
ws = w.buffer.count_leading_whitespace(y)
|
||||
ws = w.buffer.count_leading_whitespace(y)
|
||||
if lvl != ws:
|
||||
w.delete(Point(0, y), Point(ws, y))
|
||||
w.insert_string(Point(0, y), ' ' * lvl)
|
||||
if w.buffer.usetabs:
|
||||
nt = lvl // w.mode.tabwidth
|
||||
ns = lvl % w.mode.tabwidth
|
||||
s = ('\t \t' * nt) + (' ' * ns)
|
||||
else:
|
||||
s = ' ' * lvl
|
||||
w.insert_string(Point(0, y), s)
|
||||
x2 = max(x, lvl)
|
||||
if w.logical_cursor().x < x2:
|
||||
w.goto(Point(x2, y))
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
import math
|
||||
import os
|
||||
import string
|
||||
import sys
|
||||
import traceback
|
||||
from util import defaultdict
|
||||
import math, os, string
|
||||
import color, method
|
||||
from lex import Lexer
|
||||
from point import Point
|
||||
|
@ -458,8 +462,11 @@ class Fundamental(Handler):
|
|||
except Exception, e:
|
||||
if DEBUG:
|
||||
raise
|
||||
else:
|
||||
self.window.set_error(str(e))
|
||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||
data = ''.join(traceback.format_tb(exc_traceback))
|
||||
self.window.application.data_buffer("*Exception*", data,
|
||||
switch_to=False)
|
||||
self.window.set_error(str(e))
|
||||
|
||||
def region_added(self, p, newlines):
|
||||
if self.lexer is not None:
|
||||
|
|
|
@ -17,9 +17,10 @@ class ErrorGrammar(Grammar):
|
|||
PatternRule('continuation', r'\\\n$'),
|
||||
]
|
||||
|
||||
chr1 = '[a-zA-Z_]'
|
||||
chr2 = '[a-zA-Z0-9_]'
|
||||
word = chr1 + chr2 + '*'
|
||||
chr1 = '[a-zA-Z_]'
|
||||
chr2 = '[a-zA-Z0-9_]'
|
||||
word = chr1 + chr2 + '*'
|
||||
spaces = r'[\t ]+'
|
||||
|
||||
class MacroGrammar(Grammar):
|
||||
rules = [
|
||||
|
@ -36,7 +37,7 @@ class MacroGrammar(Grammar):
|
|||
|
||||
class CGrammar(Grammar):
|
||||
rules = [
|
||||
PatternRule('spaces', r' +'),
|
||||
PatternRule('spaces', spaces),
|
||||
|
||||
PatternMatchRule('x', r'(\()( *)(' + word + r')(\**)( *)(\))( *)(?=[a-zA-Z0-9_\(])',
|
||||
'delimiter', 'spaces', 'c.type', 'c.operator',
|
||||
|
|
Loading…
Reference in New Issue