parent
c95ae0fd2f
commit
5eff1a2875
2
MODES
2
MODES
|
@ -8,7 +8,7 @@ the buffer should be highlighted, how the buffer should be indented, and any
|
|||
other per-buffer configuration. The default mode ("Fundamental") provides the
|
||||
base functionality which all other modes inherit. The idea of modes is taken
|
||||
from Emacs (although the distinction between major and minor modes does not
|
||||
exist in Pmacs).
|
||||
exist in Pmacs--there are no minor modes).
|
||||
|
||||
2. Where do they come from?
|
||||
|
||||
|
|
|
@ -787,7 +787,6 @@ class Application(object):
|
|||
if slot.window is None:
|
||||
return
|
||||
w = slot.window
|
||||
modename = w.mode.name()
|
||||
|
||||
# draw the header
|
||||
if w.mode.header:
|
||||
|
@ -844,8 +843,7 @@ class Application(object):
|
|||
lines = w.buffer.lines
|
||||
count = w.mode.header
|
||||
swidth = slot.width - lm - rm
|
||||
modename = w.mode.name()
|
||||
lit = w.mode.name() in w.buffer.highlights
|
||||
lit = w.mode.name in w.buffer.highlights
|
||||
ended = False
|
||||
|
||||
# figure out which "physical line" is the first to be shown. note that
|
||||
|
|
|
@ -160,7 +160,7 @@ class Buffer(object):
|
|||
def add_window(self, w):
|
||||
if w not in self.windows:
|
||||
self.windows.append(w)
|
||||
modename = w.mode.name()
|
||||
modename = w.mode.name
|
||||
if modename not in self.highlights and w.mode.lexer is not None:
|
||||
self.highlights[modename] = highlight.Highlighter(w.mode.lexer)
|
||||
self.highlights[modename].highlight(self.lines)
|
||||
|
@ -170,12 +170,12 @@ class Buffer(object):
|
|||
def remove_window(self, w):
|
||||
if w in self.windows:
|
||||
self.windows.remove(w)
|
||||
modename = w.mode.name()
|
||||
if modename in self.highlights:
|
||||
modename = w.mode.name
|
||||
if w.mode.name in self.highlights:
|
||||
for w2 in self.windows:
|
||||
if w2.mode.name() == modename:
|
||||
if w2.mode.name == w.mode.name:
|
||||
return
|
||||
del self.highlights[modename]
|
||||
del self.highlights[w.mode.name]
|
||||
def _region_add(self, p1, p2, lines, act):
|
||||
move = DelMove(self, p1, p2)
|
||||
self.add_to_stack(move, act)
|
||||
|
|
|
@ -896,7 +896,7 @@ class CloseTag(Method):
|
|||
w.insert_string_at_cursor(self.mytag)
|
||||
app = w.application
|
||||
buffer = w.buffer
|
||||
highlighter = buffer.highlights[w.mode.name()]
|
||||
highlighter = buffer.highlights[w.mode.name]
|
||||
tokens = highlighter.tokens
|
||||
|
||||
# REFACTOR: we have methods in window to do this now
|
||||
|
|
|
@ -15,7 +15,7 @@ class ShowMode(Method):
|
|||
m = w.mode
|
||||
f = Fundamental(w)
|
||||
|
||||
lines = ['%s mode' % m.modename, '']
|
||||
lines = ['%s mode' % m.name, '']
|
||||
|
||||
seen = set()
|
||||
triples = []
|
||||
|
@ -53,7 +53,7 @@ class ShowBindingsBuffer(Method):
|
|||
'''Dump all keybindings for current mode into a new buffer'''
|
||||
def _execute(self, w, **vargs):
|
||||
lines = []
|
||||
mode_name = w.mode.name()
|
||||
mode_name = w.mode.name
|
||||
|
||||
lines.append('Key bindings for mode %r:' % (mode_name))
|
||||
lines.append('')
|
||||
|
|
|
@ -49,10 +49,9 @@ class DumpMarkers(Method):
|
|||
class DumpTokens(Method):
|
||||
'''Dump all lexical tokens (syntax highlighting debugging)'''
|
||||
def _execute(self, w, **vargs):
|
||||
modename = w.mode.name()
|
||||
lines = []
|
||||
if modename in w.buffer.highlights:
|
||||
tokens = w.buffer.highlights[modename].tokens
|
||||
if w.mode.name in w.buffer.highlights:
|
||||
tokens = w.buffer.highlights[w.mode.name].tokens
|
||||
for i in range(0, len(tokens)):
|
||||
lines.append("LINE %d" % (i + 1))
|
||||
group = tokens[i]
|
||||
|
@ -77,10 +76,9 @@ class DumpTokens(Method):
|
|||
class DumpAggregateTokenData(Method):
|
||||
'''Dump all lexical tokens into an aggregated format'''
|
||||
def _execute(self, w, **vargs):
|
||||
name = w.mode.name()
|
||||
lines = []
|
||||
if name in w.buffer.highlights:
|
||||
tokens = w.buffer.highlights[name].tokens
|
||||
if w.mode.name in w.buffer.highlights:
|
||||
tokens = w.buffer.highlights[w.mode.name].tokens
|
||||
for group in tokens:
|
||||
for token in group:
|
||||
s1 = token.name
|
||||
|
|
|
@ -119,18 +119,20 @@ class SvnStatus(Method):
|
|||
c = data[0]
|
||||
status = self.column.get(c, 'Error (%s)' % c)
|
||||
fields = data[6:].split()
|
||||
try:
|
||||
(rrev, lrev, lauthor, filename) = fields
|
||||
except:
|
||||
raise Exception, '%r %r' % (fields, data[6:])
|
||||
|
||||
w.buffer.metadata['svn-filename'] = filename
|
||||
w.buffer.metadata['svn-status'] = status
|
||||
w.buffer.metadata['svn-lrev'] = lrev
|
||||
w.buffer.metadata['svn-rrev'] = rrev
|
||||
w.buffer.metadata['svn-author'] = lauthor
|
||||
|
||||
w.set_error('%s %s %s/%s [%s]' % (filename, status, rrev, lrev, lauthor))
|
||||
if len(fields) == 4:
|
||||
rrev, lrev, lauthor, filename = fields
|
||||
w.buffer.metadata['svn-filename'] = filename
|
||||
w.buffer.metadata['svn-status'] = status
|
||||
w.buffer.metadata['svn-lrev'] = lrev
|
||||
w.buffer.metadata['svn-rrev'] = rrev
|
||||
w.buffer.metadata['svn-author'] = lauthor
|
||||
w.buffer.metadata['vc-info'] = '[svn:%s/%s]' % (lrev, rrev)
|
||||
w.set_error('%s %s %s/%s [%s]' % (filename, status, rrev, lrev, lauthor))
|
||||
else:
|
||||
w.buffer.metadata['svn-filename'] = path
|
||||
w.buffer.metadata['svn-status'] = status
|
||||
w.buffer.metadata['vc-info'] = '[svn:%s]' % status.lower()
|
||||
w.set_error('%s %s' % (path, status))
|
||||
|
||||
class SvnLog(Method):
|
||||
'''display the SVN log for the current file'''
|
||||
|
|
|
@ -77,7 +77,7 @@ class Handler(object):
|
|||
|
||||
class Fundamental(Handler):
|
||||
'''This is the default mode'''
|
||||
modename = "Fundamental"
|
||||
name = "Fundamental"
|
||||
paths = []
|
||||
basenames = []
|
||||
extensions = []
|
||||
|
@ -102,7 +102,6 @@ class Fundamental(Handler):
|
|||
actions = []
|
||||
_bindings = {}
|
||||
completers = {}
|
||||
#format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s"
|
||||
format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s %(perc)s %(vc-info)s"
|
||||
|
||||
header_size = 3
|
||||
|
@ -124,12 +123,12 @@ class Fundamental(Handler):
|
|||
rmargin = property(_get_rmargin, _set_rmargin)
|
||||
|
||||
def install(cls, app):
|
||||
app.setmode(cls.modename.lower(), cls, paths=cls.paths,
|
||||
app.setmode(cls.name.lower(), cls, paths=cls.paths,
|
||||
bases=cls.basenames, exts=cls.extensions,
|
||||
detection=cls.detection)
|
||||
for (key, val) in cls.colors.iteritems():
|
||||
if key in app.token_colors:
|
||||
s = 'token_colors: name %r conflict in %r' % (key, cls.modename)
|
||||
s = 'token_colors: name %r conflict in %r' % (key, cls.name)
|
||||
raise Exception, s
|
||||
else:
|
||||
app.token_colors[key] = val
|
||||
|
@ -290,14 +289,14 @@ class Fundamental(Handler):
|
|||
|
||||
# buffer settings
|
||||
def get_setting(self, name):
|
||||
self.window.buffer.settings.setdefault(self.modename, {})
|
||||
return self.window.buffer.settings[self.modename].get(name)
|
||||
self.window.buffer.settings.setdefault(self.name, {})
|
||||
return self.window.buffer.settings[self.name].get(name)
|
||||
def init_setting(self, name, value):
|
||||
self.window.buffer.settings.setdefault(self.modename, {})
|
||||
self.window.buffer.settings[self.modename].setdefault(name, value)
|
||||
self.window.buffer.settings.setdefault(self.name, {})
|
||||
self.window.buffer.settings[self.name].setdefault(name, value)
|
||||
def set_setting(self, name, value):
|
||||
self.window.buffer.settings.setdefault(self.modename, {})
|
||||
self.window.buffer.settings[self.modename][name] = value
|
||||
self.window.buffer.settings.setdefault(self.name, {})
|
||||
self.window.buffer.settings[self.name][name] = value
|
||||
|
||||
# header
|
||||
def showing_header(self):
|
||||
|
@ -384,10 +383,6 @@ class Fundamental(Handler):
|
|||
s = ' ' * lm
|
||||
return [RenderString(s=s, attrs=color.build('default', 'default', 'bold'))]
|
||||
|
||||
# get mode name
|
||||
def name(self):
|
||||
return self.modename
|
||||
|
||||
def _get_flag(self):
|
||||
b = self.window.buffer
|
||||
if b.readonly():
|
||||
|
@ -427,7 +422,7 @@ class Fundamental(Handler):
|
|||
d = defaultdict(str)
|
||||
d2 = {
|
||||
'bname': w.buffer.name(),
|
||||
'mname': self.name(),
|
||||
'mname': self.name,
|
||||
'flag': self._get_flag(),
|
||||
'perc': self._get_perc(),
|
||||
'indent': self._get_indent(),
|
||||
|
@ -465,11 +460,11 @@ class Fundamental(Handler):
|
|||
if DEBUG:
|
||||
raise
|
||||
else:
|
||||
err = "%s in mode '%s'" % (e, self.name())
|
||||
err = "%s in mode '%s'" % (e, self.name)
|
||||
self.window.set_error(err)
|
||||
|
||||
def region_added(self, p, newlines):
|
||||
mname = self.name()
|
||||
mname = self.name
|
||||
if self.lexer is not None:
|
||||
ydelta = len(newlines) - 1
|
||||
xdelta = len(newlines[-1])
|
||||
|
|
|
@ -131,8 +131,8 @@ class AwkFilterInput(Method):
|
|||
w.set_error("awk exited with status %d" % status)
|
||||
|
||||
class Awk(mode.Fundamental):
|
||||
name = 'awk'
|
||||
tabbercls = AwkTabber
|
||||
modename = 'awk'
|
||||
extensions = ['.awk']
|
||||
grammar = AwkGrammar
|
||||
opentokens = ('delimiter',)
|
||||
|
|
|
@ -23,7 +23,7 @@ class BDSGrammar(Grammar):
|
|||
]
|
||||
|
||||
class BDS(mode.Fundamental):
|
||||
modename = 'bds'
|
||||
name = 'bds'
|
||||
extensions = ['.bds']
|
||||
grammar = BDSGrammar
|
||||
colors = {
|
||||
|
|
|
@ -15,9 +15,9 @@ class BlameGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Blame(mode.Fundamental):
|
||||
modename = 'Blame'
|
||||
name = 'Blame'
|
||||
grammar = BlameGrammar
|
||||
colors = {
|
||||
colors = {
|
||||
'metadata.start': ('blue', 'default', 'bold'),
|
||||
'metadata.username': ('cyan', 'default', 'bold'),
|
||||
'metadata.end': ('green', 'default', 'bold'),
|
||||
|
|
|
@ -133,7 +133,7 @@ def _end(w):
|
|||
assert not w.application.mini_active
|
||||
|
||||
class Brm(mode.Fundamental):
|
||||
modename = 'Bicycle-Repairman'
|
||||
name = 'Bicycle-Repairman'
|
||||
actions = [ReplaceAll, ReplaceDone, ReplaceOne, SkipReplace, BrmCancel]
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
|
|
|
@ -156,7 +156,7 @@ class CMake(method.shell.Exec):
|
|||
cmdname='c-make')
|
||||
|
||||
class C(mode.Fundamental):
|
||||
modename = 'C'
|
||||
name = 'C'
|
||||
extensions = ['.c', '.h', '.cpp']
|
||||
tabbercls = CTabber2
|
||||
grammar = CGrammar
|
||||
|
|
|
@ -33,7 +33,7 @@ class TemplateGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Template(mode.Fundamental):
|
||||
modename = 'Cheetah'
|
||||
name = 'Cheetah'
|
||||
extensions = ['.tmpl']
|
||||
grammar = TemplateGrammar
|
||||
commentc = '##'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import mode
|
||||
|
||||
class Colortext(mode.Fundamental):
|
||||
modename = 'Colortext'
|
||||
name = 'Colortext'
|
||||
|
||||
install = Colortext.install
|
||||
|
|
|
@ -11,7 +11,7 @@ class ConfGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Conf(mode.Fundamental):
|
||||
modename = 'conf'
|
||||
name = 'conf'
|
||||
extensions = ['.conf', '.cfg', '.cnf', '.config']
|
||||
grammar = ConfGrammar
|
||||
colors = {}
|
||||
|
|
|
@ -3,6 +3,6 @@ from lex import Grammar, PatternRule, RegionRule
|
|||
from mode.python import StringGrammar1, StringGrammar2, PythonGrammar
|
||||
|
||||
class Console(mode.Fundamental):
|
||||
modename = 'Console'
|
||||
name = 'Console'
|
||||
|
||||
install = Console.install
|
||||
|
|
|
@ -214,9 +214,9 @@ class ConsoleGotoEnd(ConsoleBaseMethod):
|
|||
subcls = method.move.GotoEnd
|
||||
|
||||
class ConsoleMini(mode.Fundamental):
|
||||
modename = 'ConsoleMini'
|
||||
grammar = PythonGrammar
|
||||
actions = [ConsoleExec, ConsoleClear, ConsoleCancel, ConsoleHistoryPrev,
|
||||
name = 'ConsoleMini'
|
||||
grammar = PythonGrammar
|
||||
actions = [ConsoleExec, ConsoleClear, ConsoleCancel, ConsoleHistoryPrev,
|
||||
ConsoleHistoryNext, ConsoleTab,
|
||||
ConsolePageUp, ConsolePageDown, ConsoleGotoBeginning, ConsoleGotoEnd]
|
||||
_bindings = {
|
||||
|
|
|
@ -53,14 +53,14 @@ class CSSGrammar(Grammar):
|
|||
]
|
||||
|
||||
class CSS(mode.Fundamental):
|
||||
modename = 'CSS'
|
||||
extensions = ['.css']
|
||||
grammar = CSSGrammar
|
||||
name = 'CSS'
|
||||
extensions = ['.css']
|
||||
grammar = CSSGrammar
|
||||
opentokens = ('delimiter',)
|
||||
opentags = {'(': ')', '[': ']', '{': '}'}
|
||||
closetokens = ('delimiter',)
|
||||
closetags = {')': '(', ']': '[', '}': '{'}
|
||||
colors = {
|
||||
colors = {
|
||||
'css_dimension': ('magenta', 'default', 'bold'),
|
||||
'css_percentage': ('magenta', 'default', 'bold'),
|
||||
'css_length': ('magenta', 'default', 'bold'),
|
||||
|
|
|
@ -12,10 +12,10 @@ class DiffGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Diff(mode.Fundamental):
|
||||
modename = 'diff'
|
||||
extensions = ['.patch', '.diff']
|
||||
grammar = DiffGrammar()
|
||||
colors = {
|
||||
name = 'diff'
|
||||
extensions = ['.patch', '.diff']
|
||||
grammar = DiffGrammar()
|
||||
colors = {
|
||||
'left': ('red', 'default', 'bold'),
|
||||
'right': ('blue', 'default', 'bold'),
|
||||
'seperator': ('magenta', 'default', 'bold'),
|
||||
|
|
|
@ -163,9 +163,9 @@ class RemovePath(Method):
|
|||
w.set_error("failed to delete %r" % path)
|
||||
|
||||
class Dir(mode.Fundamental):
|
||||
modename = 'Dir'
|
||||
name = 'Dir'
|
||||
grammar = DirGrammar()
|
||||
colors = {
|
||||
colors = {
|
||||
'dir_blk.start': ('cyan', 'default', 'bold'),
|
||||
'dir_blk.dir_name': ('cyan', 'default', 'bold'),
|
||||
'dir_chr.start': ('yellow', 'default', 'bold'),
|
||||
|
|
|
@ -29,7 +29,7 @@ class ELispGrammar(Grammar):
|
|||
]
|
||||
|
||||
class ELisp(mode.Fundamental):
|
||||
modename = 'ELisp'
|
||||
name = 'ELisp'
|
||||
tabwidth = 2
|
||||
basenames = ['.emacs']
|
||||
extensions = ['.el']
|
||||
|
|
|
@ -84,7 +84,7 @@ class ErlangTabber(tab.StackTabber):
|
|||
# Interact._execute(self, w, bname='*Erl*', cmd='erl')
|
||||
|
||||
class Erlang(mode.Fundamental):
|
||||
modename = 'Erlang'
|
||||
name = 'Erlang'
|
||||
extensions = ['.erl']
|
||||
tabwidth = 4
|
||||
tabbercls = ErlangTabber
|
||||
|
|
|
@ -40,7 +40,7 @@ class ErrorGotoLine(Method):
|
|||
w.set_error(errline)
|
||||
|
||||
class Error(mode.Fundamental):
|
||||
modename = 'Error'
|
||||
name = 'Error'
|
||||
actions = [ErrorGotoLine]
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
|
|
|
@ -119,7 +119,7 @@ class ForthTabber(tab.StackTabber2):
|
|||
self.curr_level = 0
|
||||
|
||||
class Forth(Fundamental):
|
||||
modename = 'FORTH'
|
||||
name = 'FORTH'
|
||||
extensions = ['.fs', '.fi', '.fb']
|
||||
grammar = ForthGrammar
|
||||
commentc = '\\ '
|
||||
|
|
|
@ -15,7 +15,7 @@ class FstabGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Fstab(mode.Fundamental):
|
||||
modename = 'fstab'
|
||||
name = 'fstab'
|
||||
basenames = ['fstab']
|
||||
grammar = FstabGrammar
|
||||
colors = {
|
||||
|
|
|
@ -57,17 +57,17 @@ class HaskellTabber(tab.Tabber):
|
|||
pass
|
||||
|
||||
class Haskell(mode.Fundamental):
|
||||
modename = 'Haskell'
|
||||
extensions = ['.hs']
|
||||
tabwidth = 4
|
||||
commentc = '--'
|
||||
#tabbercls = mode.lisp.LispTabber
|
||||
grammar = HaskellGrammar
|
||||
name = 'Haskell'
|
||||
extensions = ['.hs']
|
||||
tabwidth = 4
|
||||
commentc = '--'
|
||||
#tabbercls = mode.lisp.LispTabber
|
||||
grammar = HaskellGrammar
|
||||
opentokens = ('delimiter',)
|
||||
opentags = {'(': ')', '{': '}', '[': ']'}
|
||||
closetokens = ('delimiter',)
|
||||
closetags = {')': '(', '}': '{', ']': '['}
|
||||
colors = {
|
||||
colors = {
|
||||
'hs_constructor': ('magenta', 'default', 'bold'),
|
||||
'hs_declaration': ('blue', 'default', 'bold'),
|
||||
'hs_variable': ('yellow', 'default', 'bold'),
|
||||
|
|
10
mode/hex.py
10
mode/hex.py
|
@ -215,14 +215,14 @@ class ShowAddress(Method):
|
|||
w.set_error("Cursor's address is 0x%08x" % addr)
|
||||
|
||||
class Hex(mode.Fundamental):
|
||||
modename = 'Hex'
|
||||
name = 'Hex'
|
||||
config = {
|
||||
'hex.disinst': 'disinst',
|
||||
}
|
||||
lmargin = 12
|
||||
rmargin = 18
|
||||
_ctrans = ['.'] * 256
|
||||
byteorder = 'native'
|
||||
lmargin = 12
|
||||
rmargin = 18
|
||||
_ctrans = ['.'] * 256
|
||||
byteorder = 'native'
|
||||
byteorders = {
|
||||
'native': '=',
|
||||
'little': '<',
|
||||
|
|
|
@ -73,7 +73,7 @@ class HtmlCheckSpelling(method.Method):
|
|||
w.buffer.reload()
|
||||
|
||||
class HTML(mode.Fundamental):
|
||||
modename = 'HTML'
|
||||
name = 'HTML'
|
||||
extensions = ['.html', '.htm', '.shtml', '.shtm', '.xhtml']
|
||||
grammar = HTMLGrammar
|
||||
colors = {
|
||||
|
|
|
@ -25,7 +25,7 @@ class MiniInsertCancel(method.Method):
|
|||
w.application.close_mini_buffer()
|
||||
|
||||
class InsertMini(mode.Fundamental):
|
||||
modename = 'InsertMini'
|
||||
name = 'InsertMini'
|
||||
actions = [MiniInsertLine, MiniInsertComplete, MiniInsertCancel,
|
||||
MiniInsertTab]
|
||||
def __init__(self, w):
|
||||
|
|
|
@ -10,9 +10,9 @@ class IperlGrammar(Grammar):
|
|||
PatternRule(r'iperl_reserved', r'undef'),
|
||||
]
|
||||
class Iperl(mode.Fundamental):
|
||||
modename = 'IPerl'
|
||||
name = 'IPerl'
|
||||
grammar = IperlGrammar()
|
||||
colors = {
|
||||
colors = {
|
||||
'iperl_input.start': ('red', 'default', 'bold'),
|
||||
'iperl_reserved': ('magenta', 'default', 'bold'),
|
||||
}
|
||||
|
|
|
@ -91,9 +91,9 @@ class IperlGotoEnd(mode.consolemini.ConsoleGotoEnd):
|
|||
subbuf = '*IPerl*'
|
||||
|
||||
class IperlMini(mode.Fundamental):
|
||||
modename = 'IperlMini'
|
||||
actions = [IperlExec, IperlTab, IperlStart, IperlPathStart,
|
||||
IperlPageUp, IperlPageDown, IperlGotoBeginning, IperlGotoEnd]
|
||||
name = 'IperlMini'
|
||||
actions = [IperlExec, IperlTab, IperlStart, IperlPathStart,
|
||||
IperlPageUp, IperlPageDown, IperlGotoBeginning, IperlGotoEnd]
|
||||
readre = re.compile('^([A-Z]+):(.*)\n$')
|
||||
def _readline(self):
|
||||
b = self.get_iperl()
|
||||
|
|
|
@ -11,9 +11,9 @@ class IpythonGrammar(Grammar):
|
|||
PatternRule(r'ipython_reserved', r'undef'),
|
||||
]
|
||||
class Ipython(mode.Fundamental):
|
||||
modename = 'IPython'
|
||||
name = 'IPython'
|
||||
grammar = IpythonGrammar()
|
||||
colors = {
|
||||
colors = {
|
||||
'ipython_input.start': ('red', 'default', 'bold'),
|
||||
'ipython_reserved': ('magenta', 'default', 'bold'),
|
||||
}
|
||||
|
|
|
@ -88,9 +88,9 @@ class IpythonGotoEnd(mode.consolemini.ConsoleGotoEnd):
|
|||
subbuf = '*IPython*'
|
||||
|
||||
class IpythonMini(mode.Fundamental):
|
||||
modename = 'IpythonMini'
|
||||
actions = [IpythonExec, IpythonTab, IpythonStart, IpythonPathStart,
|
||||
IpythonPageUp, IpythonPageDown, IpythonGotoBeginning, IpythonGotoEnd]
|
||||
name = 'IpythonMini'
|
||||
actions = [IpythonExec, IpythonTab, IpythonStart, IpythonPathStart,
|
||||
IpythonPageUp, IpythonPageDown, IpythonGotoBeginning, IpythonGotoEnd]
|
||||
def get_ipython(self):
|
||||
return self.window.buffer.method.main_buffer
|
||||
def read_sync(self):
|
||||
|
|
|
@ -117,7 +117,7 @@ class JavaContext(context.Context):
|
|||
i += 1
|
||||
|
||||
class Java(mode.Fundamental):
|
||||
modename = 'Java'
|
||||
name = 'Java'
|
||||
extensions = ['.java']
|
||||
tabbercls = JavaTabber2
|
||||
grammar = JavaGrammar
|
||||
|
|
|
@ -75,7 +75,7 @@ class JavascriptTabber2(tab.StackTabber2):
|
|||
def is_base(self, y):
|
||||
if y == 0:
|
||||
return True
|
||||
highlighter = self.mode.window.buffer.highlights[self.mode.name()]
|
||||
highlighter = self.mode.window.buffer.highlights[self.mode.name]
|
||||
if not highlighter.tokens[y]:
|
||||
return False
|
||||
t = highlighter.tokens[y][0]
|
||||
|
@ -87,7 +87,7 @@ class JavascriptTabber2(tab.StackTabber2):
|
|||
'comment.data', 'comment.null', 'comment.end')
|
||||
|
||||
class Javascript(mode.Fundamental):
|
||||
modename = 'Javascript'
|
||||
name = 'Javascript'
|
||||
extensions = ['.js']
|
||||
grammar = JavascriptGrammar
|
||||
tabbercls = JavascriptTabber2
|
||||
|
|
|
@ -114,7 +114,7 @@ class LatexCheckSpelling(method.Method):
|
|||
w.buffer.reload()
|
||||
|
||||
class Latex(mode.Fundamental):
|
||||
modename = 'Latex'
|
||||
name = 'Latex'
|
||||
extensions = ['.latex', '.tex']
|
||||
commentc = '%'
|
||||
grammar = LatexGrammar
|
||||
|
|
|
@ -52,10 +52,10 @@ class LilyTabber(tab.StackTabber):
|
|||
st = ('spaces', 'null',)
|
||||
|
||||
class Lily(mode.Fundamental):
|
||||
modename = 'lily'
|
||||
name = 'lily'
|
||||
extensions = ['.ly']
|
||||
tabwidth = 2
|
||||
tabbercls = LilyTabber
|
||||
tabwidth = 2
|
||||
tabbercls = LilyTabber
|
||||
grammar = LilyGrammar
|
||||
commentc = '%'
|
||||
colors = {
|
||||
|
|
|
@ -36,7 +36,7 @@ class LispTabber(tab.StackTabber):
|
|||
return currlvl
|
||||
|
||||
class Lisp(mode.Fundamental):
|
||||
modename = 'Lisp'
|
||||
name = 'Lisp'
|
||||
tabwidth = 2
|
||||
tabbercls = LispTabber
|
||||
grammar = LispGrammar
|
||||
|
|
|
@ -38,7 +38,7 @@ class LuaCheckSyntax(method.Method):
|
|||
app.data_buffer("*Lua-Check-Syntax*", output)
|
||||
|
||||
class Lua(mode.Fundamental):
|
||||
modename = 'Lua'
|
||||
name = 'Lua'
|
||||
extensions = ['.lua']
|
||||
#tabbercls = mode.lisp.LispTabber
|
||||
grammar = LuaGrammar
|
||||
|
@ -49,7 +49,7 @@ class Lua(mode.Fundamental):
|
|||
closetags = {')': '(', ']': '[', '}': '{'}
|
||||
colors = {}
|
||||
actions = [LuaCheckSyntax]
|
||||
_bindings = {
|
||||
_bindings = {
|
||||
'close-paren': (')',),
|
||||
'close-brace': ('}',),
|
||||
'close-bracket': (']',),
|
||||
|
|
|
@ -33,7 +33,7 @@ class MakeGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Make(mode.Fundamental):
|
||||
modename = 'Make'
|
||||
name = 'Make'
|
||||
basenames = ['Makefile']
|
||||
grammar = MakeGrammar
|
||||
commentc = '#'
|
||||
|
|
12
mode/mbox.py
12
mode/mbox.py
|
@ -210,8 +210,8 @@ class MailListGrammar(Grammar):
|
|||
]
|
||||
|
||||
class MboxMsg(mode.Fundamental):
|
||||
modename = 'MboxMsg'
|
||||
colors = {
|
||||
name = 'MboxMsg'
|
||||
colors = {
|
||||
'mail_pgp': ('red', 'default', 'bold'),
|
||||
'mail_signature.start': ('red', 'default', 'bold'),
|
||||
'mail_signature.data': ('red', 'default', 'bold'),
|
||||
|
@ -230,10 +230,10 @@ class MboxMsg(mode.Fundamental):
|
|||
mode.Fundamental.__init__(self, w)
|
||||
|
||||
class Mbox(mode.Fundamental):
|
||||
modename = 'Mbox'
|
||||
grammar = MailListGrammar
|
||||
actions = [MboxRefresh, MboxOpenPath, MboxReadMsg]
|
||||
colors = {
|
||||
name = 'Mbox'
|
||||
grammar = MailListGrammar
|
||||
actions = [MboxRefresh, MboxOpenPath, MboxReadMsg]
|
||||
colors = {
|
||||
'index': ('default', 'default', 'bold'),
|
||||
'flag': ('yellow', 'default', 'bold'),
|
||||
'month': ('green', 'default', 'bold'),
|
||||
|
|
|
@ -38,8 +38,8 @@ class MiniTabComplete(method.Method):
|
|||
use_completion_window(app, s2, candidates)
|
||||
|
||||
class Mini(mode.Fundamental):
|
||||
modename = 'Mini'
|
||||
actions = [MiniCallback, MiniTabComplete]
|
||||
name = 'Mini'
|
||||
actions = [MiniCallback, MiniTabComplete]
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
self.add_bindings('mini-callback', ('RETURN',))
|
||||
|
|
|
@ -122,10 +122,10 @@ class Mp3OpenPath(Method):
|
|||
w.application.switch_buffer(b)
|
||||
|
||||
class Mp3(mode.Fundamental):
|
||||
modename = 'Mp3'
|
||||
grammar = Mp3Grammar
|
||||
actions = [Mp3Refresh, Mp3OpenPath]
|
||||
colors = {
|
||||
name = 'Mp3'
|
||||
grammar = Mp3Grammar
|
||||
actions = [Mp3Refresh, Mp3OpenPath]
|
||||
colors = {
|
||||
'mp3_label': ('blue', 'default', 'bold'),
|
||||
'mp3_tag.start': ('default', 'default', 'bold'),
|
||||
'mp3_tag.data': ('green', 'default', 'bold'),
|
||||
|
|
|
@ -24,9 +24,9 @@ class MuttInsertSpace(mode.text.TextInsertSpace):
|
|||
wrapper = MuttWrapParagraph
|
||||
|
||||
class Mutt(mode.Fundamental):
|
||||
modename = 'Mutt'
|
||||
grammar = MuttGrammar()
|
||||
colors = {
|
||||
name = 'Mutt'
|
||||
grammar = MuttGrammar()
|
||||
colors = {
|
||||
'mutt_header': ('green', 'default', 'bold'),
|
||||
'email': ('cyan', 'default', 'bold'),
|
||||
'url': ('cyan', 'default', 'bold'),
|
||||
|
|
|
@ -26,7 +26,7 @@ class NasmGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Nasm(mode.Fundamental):
|
||||
modename = 'nasm'
|
||||
name = 'nasm'
|
||||
extensions = ['.s']
|
||||
grammar = NasmGrammar
|
||||
commentc = ';'
|
||||
|
|
|
@ -48,7 +48,7 @@ class OcamlGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Ocaml(mode.Fundamental):
|
||||
modename = 'ocaml'
|
||||
name = 'ocaml'
|
||||
extensions = ['.mli', '.ml']
|
||||
grammar = OcamlGrammar
|
||||
opentokens = ('delimiter',)
|
||||
|
|
|
@ -420,7 +420,7 @@ class PerlWrapParagraph(method.WrapParagraph):
|
|||
return t.name == 'spaces'
|
||||
|
||||
def _detect_line_type(self, w, y):
|
||||
h = w.buffer.highlights[w.mode.name()]
|
||||
h = w.buffer.highlights[w.mode.name]
|
||||
ltype = None
|
||||
for t in h.tokens[y]:
|
||||
fqname = t.fqname()
|
||||
|
@ -442,7 +442,7 @@ class PerlWrapParagraph(method.WrapParagraph):
|
|||
return ltype
|
||||
|
||||
def _fix_comments(self, c, w):
|
||||
h = w.buffer.highlights[w.mode.name()]
|
||||
h = w.buffer.highlights[w.mode.name]
|
||||
y1 = c.y
|
||||
y2 = c.y
|
||||
while y2 < len(w.buffer.lines) - 1:
|
||||
|
@ -621,7 +621,7 @@ class PerlContext(context.Context):
|
|||
i += 1
|
||||
|
||||
class Perl(mode.Fundamental):
|
||||
modename = 'Perl'
|
||||
name = 'Perl'
|
||||
extensions = ['.pl', '.pm', '.pod']
|
||||
detection = ['perl']
|
||||
tabbercls = PerlTabber2
|
||||
|
|
|
@ -40,7 +40,7 @@ class PHPGrammar(Grammar):
|
|||
# if y == 0:
|
||||
# return True
|
||||
#
|
||||
# highlighter = self.mode.window.buffer.highlights[self.mode.name()]
|
||||
# highlighter = self.mode.window.buffer.highlights[self.mode.name]
|
||||
# if not highlighter.tokens[y]:
|
||||
# return False
|
||||
#
|
||||
|
@ -161,7 +161,7 @@ class PHPGrammar(Grammar):
|
|||
# return currlvl
|
||||
|
||||
class PHP(mode.Fundamental):
|
||||
modename = 'PHP'
|
||||
name = 'PHP'
|
||||
extensions = ['.php']
|
||||
#tabbercls = JavaTabber
|
||||
grammar = PHPGrammar
|
||||
|
|
|
@ -19,7 +19,7 @@ class PipeInsertEsc(PipeInsertChr):
|
|||
self.string = chr(27) + chr(i)
|
||||
|
||||
class Pipe(Fundamental):
|
||||
modename = 'pipe'
|
||||
name = 'pipe'
|
||||
def __init__(self, w):
|
||||
Fundamental.__init__(self, w)
|
||||
|
||||
|
|
|
@ -541,7 +541,7 @@ class PythonContext(context.Context):
|
|||
self.namelines[k] = (curr, None)
|
||||
|
||||
class Python(mode.Fundamental):
|
||||
modename = 'Python'
|
||||
name = 'Python'
|
||||
extensions = ['.py']
|
||||
detection = ['python']
|
||||
tabbercls = PythonTabber
|
||||
|
@ -580,7 +580,7 @@ class Python(mode.Fundamental):
|
|||
"pythonclass": PythonClassCompleter(None),
|
||||
}
|
||||
|
||||
format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s [%(name)s]"
|
||||
format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s [%(name)s] %(vc-info)s"
|
||||
header_size = 3
|
||||
|
||||
def get_status_names(self):
|
||||
|
@ -592,7 +592,7 @@ class Python(mode.Fundamental):
|
|||
|
||||
# xyz
|
||||
def get_header(self):
|
||||
fg, bg = "default", "red"
|
||||
fg, bg = "default", "blue"
|
||||
|
||||
if self.tabber is None:
|
||||
s = "Header support is not available for this mode"
|
||||
|
|
|
@ -133,7 +133,7 @@ def _end(w):
|
|||
assert not w.application.mini_active
|
||||
|
||||
class Replace(mode.Fundamental):
|
||||
modename = 'Replace'
|
||||
name = 'Replace'
|
||||
actions = [ReplaceAll, ReplaceDone, ReplaceOne, SkipReplace, CancelReplace]
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
|
|
|
@ -54,7 +54,7 @@ class RstBuild(Method):
|
|||
pass
|
||||
|
||||
class RST(mode.Fundamental):
|
||||
modename = 'RST'
|
||||
name = 'RST'
|
||||
extensions = ['.rst']
|
||||
grammar = RSTGrammar
|
||||
colors = {
|
||||
|
|
|
@ -51,7 +51,7 @@ class GuileLoadFile(method.shell.Interact):
|
|||
b.pipe_write('(load "%s")\n' % path)
|
||||
|
||||
class Scheme(mode.Fundamental):
|
||||
modename = 'Scheme'
|
||||
name = 'Scheme'
|
||||
extensions = ['.scm']
|
||||
tabwidth = 2
|
||||
tabbercls = mode.lisp.LispTabber
|
||||
|
|
|
@ -116,7 +116,7 @@ def _end(w):
|
|||
w.application.last_search = w.buffer.make_string()
|
||||
|
||||
class Search(mode.Fundamental):
|
||||
modename = 'Search'
|
||||
name = 'Search'
|
||||
actions = [SearchNext, SearchPrevious, EndSearch, CancelSearch,
|
||||
SearchDeleteLeft, SearchDeleteLeftWord]
|
||||
def __init__(self, w):
|
||||
|
|
20
mode/sh.py
20
mode/sh.py
|
@ -129,7 +129,7 @@ class ShTabber(tab.StackTabber):
|
|||
def is_base(self, y):
|
||||
if y == 0:
|
||||
return True
|
||||
highlighter = self.mode.window.buffer.highlights[self.mode.name()]
|
||||
highlighter = self.mode.window.buffer.highlights[self.mode.name]
|
||||
if not highlighter.tokens[y]:
|
||||
return False
|
||||
t = highlighter.tokens[y][0]
|
||||
|
@ -166,15 +166,15 @@ class ShCheckSyntax(Method):
|
|||
app.data_buffer("*Sh-Check-Syntax*", output)
|
||||
|
||||
class Sh(mode.Fundamental):
|
||||
modename = 'sh'
|
||||
paths = ['/etc/profile']
|
||||
basenames = ['.bashrc', '.bash_profile', '.profile']
|
||||
extensions = ['.bash', '.sh']
|
||||
detection = ['sh', 'bash']
|
||||
grammar = ShGrammar
|
||||
tabbercls = ShTabber
|
||||
opentokens = ('delimiter', 'sh_reserved', 'case.start')
|
||||
opentags = {'(': ')', '[': ']', '{': '}', 'do': 'done', 'then': 'fi',
|
||||
name = 'sh'
|
||||
paths = ['/etc/profile']
|
||||
basenames = ['.bashrc', '.bash_profile', '.profile']
|
||||
extensions = ['.bash', '.sh']
|
||||
detection = ['sh', 'bash']
|
||||
grammar = ShGrammar
|
||||
tabbercls = ShTabber
|
||||
opentokens = ('delimiter', 'sh_reserved', 'case.start')
|
||||
opentags = {'(': ')', '[': ']', '{': '}', 'do': 'done', 'then': 'fi',
|
||||
'case': 'esac'}
|
||||
closetokens = ('delimiter', 'sh_reserved', 'case.end')
|
||||
closetags = {')': '(', ']': '[', '}': '{', 'done': 'do', 'fi': 'then',
|
||||
|
|
|
@ -8,9 +8,9 @@ class ShellGrammar(Grammar):
|
|||
PatternRule(r'shell_mesg', r'^===.*$'),
|
||||
]
|
||||
class Shell(mode.Fundamental):
|
||||
modename = 'Shell'
|
||||
name = 'Shell'
|
||||
grammar = ShellGrammar()
|
||||
colors = {
|
||||
colors = {
|
||||
'shell_mesg': ('green', 'default', 'bold'),
|
||||
'shell_input': ('cyan', 'default', 'bold'),
|
||||
}
|
||||
|
|
|
@ -130,12 +130,12 @@ class OpenShell(OpenShellRaw):
|
|||
w.application.open_mini_buffer('>>> ', f, self, None, 'shellmini')
|
||||
|
||||
class ShellMini(mode.Fundamental):
|
||||
modename = 'ShellMini'
|
||||
actions = [ShellExec, ShellClear, ShellCancel,
|
||||
ShellHistoryPrev, ShellHistoryNext,
|
||||
ShellTab,
|
||||
ShellPageUp, ShellPageDown, ShellGotoBeginning, ShellGotoEnd,
|
||||
OpenShell, OpenShellRaw]
|
||||
name = 'ShellMini'
|
||||
actions = [ShellExec, ShellClear, ShellCancel,
|
||||
ShellHistoryPrev, ShellHistoryNext,
|
||||
ShellTab,
|
||||
ShellPageUp, ShellPageDown, ShellGotoBeginning, ShellGotoEnd,
|
||||
OpenShell, OpenShellRaw]
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
self.saved_input = ""
|
||||
|
|
|
@ -73,7 +73,7 @@ class SqlTabber(tab.StackTabber):
|
|||
def is_base(self, y):
|
||||
if y == 0:
|
||||
return True
|
||||
highlighter = self.mode.window.buffer.highlights[self.mode.name()]
|
||||
highlighter = self.mode.window.buffer.highlights[self.mode.name]
|
||||
if not highlighter.tokens[y]:
|
||||
return False
|
||||
t = highlighter.tokens[y][0]
|
||||
|
@ -113,7 +113,7 @@ class SqlTabber(tab.StackTabber):
|
|||
return currlvl
|
||||
|
||||
class Sql(mode.Fundamental):
|
||||
modename = 'Sql'
|
||||
name = 'Sql'
|
||||
extensions = ['.sql']
|
||||
grammar = SqlGrammar
|
||||
tabbercls = SqlTabber
|
||||
|
|
12
mode/text.py
12
mode/text.py
|
@ -54,7 +54,7 @@ class LearnWord(method.Method):
|
|||
|
||||
cursor = w.logical_cursor()
|
||||
word = None
|
||||
for token in w.buffer.highlights[w.mode.name()].tokens[cursor.y]:
|
||||
for token in w.buffer.highlights[w.mode.name].tokens[cursor.y]:
|
||||
if (token.x <= cursor.x and
|
||||
token.end_x() > cursor.x and
|
||||
token.name == 'misspelled'):
|
||||
|
@ -72,11 +72,11 @@ class LearnWord(method.Method):
|
|||
w.left_delete()
|
||||
|
||||
class Text(mode.Fundamental):
|
||||
modename = 'Text'
|
||||
extensions=['.txt']
|
||||
grammar = TextGrammar
|
||||
actions = [LearnWord, TextInsertSpace, TextWrapParagraph]
|
||||
config = {
|
||||
name = 'Text'
|
||||
extensions = ['.txt']
|
||||
grammar = TextGrammar
|
||||
actions = [LearnWord, TextInsertSpace, TextWrapParagraph]
|
||||
config = {
|
||||
'text.margin': 78,
|
||||
}
|
||||
def __init__(self, w):
|
||||
|
|
|
@ -13,7 +13,7 @@ class Text2Grammar(Grammar):
|
|||
]
|
||||
|
||||
class Text2(mode.text.Text):
|
||||
modename = 'Text2'
|
||||
name = 'Text2'
|
||||
grammar = Text2Grammar
|
||||
extensions = ['.txt']
|
||||
extensions = []
|
||||
|
|
|
@ -30,7 +30,7 @@ class TemplateGrammar(Grammar):
|
|||
]
|
||||
|
||||
class Template(mode.Fundamental):
|
||||
modename = 'Template'
|
||||
name = 'Template'
|
||||
extensions = ['.tt']
|
||||
grammar = TemplateGrammar
|
||||
colors = {
|
||||
|
|
|
@ -2,7 +2,7 @@ import color, method, mode
|
|||
from point import Point
|
||||
|
||||
class Which(mode.Fundamental):
|
||||
modename = 'Which'
|
||||
name = 'Which'
|
||||
def __init__(self, w):
|
||||
mode.Fundamental.__init__(self, w)
|
||||
old_mode = w.buffer.method.old_window.mode
|
||||
|
@ -22,7 +22,7 @@ class Which(mode.Fundamental):
|
|||
if mode.DEBUG:
|
||||
raise
|
||||
else:
|
||||
err = "%s in mode '%s'" % (e, self.name())
|
||||
err = "%s in mode '%s'" % (e, self.name)
|
||||
self.window.application.set_error(err)
|
||||
self._end()
|
||||
def _end(self):
|
||||
|
|
|
@ -113,7 +113,7 @@ class XmlCreateCdata(method.Method):
|
|||
w.goto(p)
|
||||
|
||||
class XML(mode.Fundamental):
|
||||
modename = 'XML'
|
||||
name = 'XML'
|
||||
extensions = ['.xml', '.xml.in', '.xsl', '.xsd']
|
||||
grammar = XMLGrammar
|
||||
colors = {
|
||||
|
|
|
@ -42,11 +42,11 @@ class YaccTabber(CTabber2):
|
|||
end_free_tokens = {'string.end': 'string.start'}
|
||||
|
||||
class Yacc(mode.Fundamental):
|
||||
modename = 'yacc'
|
||||
name = 'yacc'
|
||||
extensions = ['.y']
|
||||
grammar = YaccGrammar
|
||||
tabbercls = YaccTabber
|
||||
colors = {
|
||||
colors = {
|
||||
'yacc_directive': ('yellow', 'default', 'bold'),
|
||||
'yacc_section': ('yellow', 'default', 'bold'),
|
||||
'yacc_delimiter': ('yellow', 'default', 'bold'),
|
||||
|
|
8
tab.py
8
tab.py
|
@ -19,11 +19,11 @@ class Tabber(object):
|
|||
self.lines = {}
|
||||
|
||||
def get_highlighter(self):
|
||||
return self.mode.window.buffer.highlights[self.mode.name()]
|
||||
return self.mode.window.buffer.highlights[self.mode.name]
|
||||
def get_tokens(self, y):
|
||||
return self.mode.window.buffer.highlights[self.mode.name()].tokens[y]
|
||||
return self.mode.window.buffer.highlights[self.mode.name].tokens[y]
|
||||
def get_token(self, y, i):
|
||||
return self.mode.window.buffer.highlights[self.mode.name()].tokens[y][i]
|
||||
return self.mode.window.buffer.highlights[self.mode.name].tokens[y][i]
|
||||
|
||||
def token_is_whitespace(self, y, i):
|
||||
token = self.get_token(y, i)
|
||||
|
@ -256,7 +256,7 @@ class StackTabber2(Tabber):
|
|||
fixed_indent = False
|
||||
def __init__(self, m):
|
||||
self.mode = m
|
||||
self.name = m.name()
|
||||
self.name = m.name
|
||||
self.lines = {}
|
||||
self._reset()
|
||||
def region_added(self, p, newlines):
|
||||
|
|
4
util.py
4
util.py
|
@ -54,14 +54,14 @@ def dump(x):
|
|||
return '%s: %r' % (x, d)
|
||||
|
||||
def get_margin_limit(w, def_limit=80):
|
||||
lname = '%s.margin' % w.mode.name().lower()
|
||||
lname = '%s.margin' % w.mode.name.lower()
|
||||
if lname in w.application.config:
|
||||
return w.application.config[lname]
|
||||
else:
|
||||
return w.application.config.get('margin', def_limit)
|
||||
|
||||
def get_margin_color(w, def_color='blue'):
|
||||
lname = '%s.margin_color' % w.mode.name().lower()
|
||||
lname = '%s.margin_color' % w.mode.name.lower()
|
||||
if lname in w.application.config:
|
||||
return w.application.config[lname]
|
||||
else:
|
||||
|
|
15
window.py
15
window.py
|
@ -83,17 +83,16 @@ class Window(object):
|
|||
# mode stuff
|
||||
def set_mode(self, m):
|
||||
self.mode = m
|
||||
modename = m.name()
|
||||
if modename not in self.buffer.highlights and m.lexer is not None:
|
||||
self.buffer.highlights[modename] = highlight.Highlighter(m.lexer)
|
||||
self.buffer.highlights[modename].highlight(self.buffer.lines)
|
||||
if m.name not in self.buffer.highlights and m.lexer is not None:
|
||||
self.buffer.highlights[m.name] = highlight.Highlighter(m.lexer)
|
||||
self.buffer.highlights[m.name].highlight(self.buffer.lines)
|
||||
|
||||
#self.redraw()
|
||||
def get_highlighter(self):
|
||||
if self.mode.lexer is None:
|
||||
return None
|
||||
else:
|
||||
return self.buffer.highlights[self.mode.name()]
|
||||
return self.buffer.highlights[self.mode.name]
|
||||
|
||||
# this is used to temporarily draw the user's attention to another point
|
||||
def set_active_point(self, p, msg='marking on line %(y)d, char %(x)d'):
|
||||
|
@ -721,8 +720,7 @@ class Window(object):
|
|||
# render methods return a list of lists of RenderString objects
|
||||
# (i.e. multiple physical lines containing multiple areas to be drawn)
|
||||
def render_line(self, y, width):
|
||||
modename = self.mode.name()
|
||||
if modename in self.buffer.highlights:
|
||||
if self.mode.name in self.buffer.highlights:
|
||||
return self.render_line_lit(y, width)
|
||||
else:
|
||||
return self.render_line_raw(y, width)
|
||||
|
@ -749,8 +747,7 @@ class Window(object):
|
|||
r = RenderString(s='~', attrs=color.build('red', 'default'))
|
||||
return [(r,)]
|
||||
|
||||
modename = self.mode.name()
|
||||
highlighter = self.buffer.highlights[modename]
|
||||
highlighter = self.buffer.highlights[self.mode.name]
|
||||
|
||||
line = []
|
||||
lines = []
|
||||
|
|
Loading…
Reference in New Issue