parent
a46c0e8347
commit
8a77dafb42
|
@ -709,7 +709,6 @@ class Application(object):
|
||||||
p = w.logical_cursor()
|
p = w.logical_cursor()
|
||||||
|
|
||||||
blen = len(w.buffer.lines)
|
blen = len(w.buffer.lines)
|
||||||
#count = 0
|
|
||||||
count = w.mode.header #XYZ
|
count = w.mode.header #XYZ
|
||||||
(x, y) = w.first.xy()
|
(x, y) = w.first.xy()
|
||||||
(vy, vx) = (None, None)
|
(vy, vx) = (None, None)
|
||||||
|
|
|
@ -67,6 +67,7 @@ class Buffer(object):
|
||||||
self.nl = '\n'
|
self.nl = '\n'
|
||||||
self.modified = False
|
self.modified = False
|
||||||
self.highlights = {}
|
self.highlights = {}
|
||||||
|
self.settings = {}
|
||||||
self.indentlvl = 4
|
self.indentlvl = 4
|
||||||
self.writetabs = False
|
self.writetabs = False
|
||||||
|
|
||||||
|
@ -161,6 +162,8 @@ class Buffer(object):
|
||||||
if modename not in self.highlights and w.mode.lexer is not None:
|
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.Highlighter(w.mode.lexer)
|
||||||
self.highlights[modename].highlight(self.lines)
|
self.highlights[modename].highlight(self.lines)
|
||||||
|
if modename not in self.settings:
|
||||||
|
self.settings[modename] = {}
|
||||||
|
|
||||||
def remove_window(self, w):
|
def remove_window(self, w):
|
||||||
if w in self.windows:
|
if w in self.windows:
|
||||||
|
|
|
@ -100,11 +100,19 @@ class Fundamental(Handler):
|
||||||
completers = {}
|
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/%(mark)s %(perc)s"
|
||||||
|
|
||||||
# margins
|
## margins
|
||||||
header = 0
|
def get_header(self): return self.get_setting('header')
|
||||||
footer = 0
|
def set_header(self, value): return self.set_setting('header', value)
|
||||||
lmargin = 0
|
header = property(get_header, set_header)
|
||||||
rmargin = 1
|
def get_footer(self): return self.get_setting('footer')
|
||||||
|
def set_footer(self, value): return self.set_setting('footer', value)
|
||||||
|
footer = property(get_footer, set_footer)
|
||||||
|
def get_lmargin(self): return self.get_setting('lmargin')
|
||||||
|
def set_lmargin(self, value): return self.set_setting('lmargin', value)
|
||||||
|
lmargin = property(get_lmargin, set_lmargin)
|
||||||
|
def get_rmargin(self): return self.get_setting('rmargin')
|
||||||
|
def set_rmargin(self, value): return self.set_setting('rmargin', value)
|
||||||
|
rmargin = property(get_rmargin, set_rmargin)
|
||||||
|
|
||||||
def install(cls, app):
|
def install(cls, app):
|
||||||
app.setmode(cls.modename.lower(), cls, paths=cls.paths,
|
app.setmode(cls.modename.lower(), cls, paths=cls.paths,
|
||||||
|
@ -148,6 +156,12 @@ class Fundamental(Handler):
|
||||||
self.window = w
|
self.window = w
|
||||||
Handler.__init__(self)
|
Handler.__init__(self)
|
||||||
|
|
||||||
|
#xyz
|
||||||
|
self.init_setting('lmargin', 0)
|
||||||
|
self.init_setting('rmargin', 1)
|
||||||
|
self.init_setting('header', 0)
|
||||||
|
self.init_setting('footer', 0)
|
||||||
|
|
||||||
# first let's add all the "default" actions
|
# first let's add all the "default" actions
|
||||||
self.add_bindings('start-of-line', ('C-a', 'HOME',))
|
self.add_bindings('start-of-line', ('C-a', 'HOME',))
|
||||||
self.add_bindings('end-of-line', ('C-e', 'END',))
|
self.add_bindings('end-of-line', ('C-e', 'END',))
|
||||||
|
@ -258,6 +272,17 @@ class Fundamental(Handler):
|
||||||
if self.tabbercls:
|
if self.tabbercls:
|
||||||
self.tabber = self.tabbercls(self)
|
self.tabber = self.tabbercls(self)
|
||||||
|
|
||||||
|
# buffer settings
|
||||||
|
def get_setting(self, name):
|
||||||
|
self.window.buffer.settings.setdefault(self.modename, {})
|
||||||
|
return self.window.buffer.settings[self.modename].get(name)
|
||||||
|
def init_setting(self, name, value):
|
||||||
|
self.window.buffer.settings.setdefault(self.modename, {})
|
||||||
|
self.window.buffer.settings[self.modename].setdefault(name, value)
|
||||||
|
def set_setting(self, name, value):
|
||||||
|
self.window.buffer.settings.setdefault(self.modename, {})
|
||||||
|
self.window.buffer.settings[self.modename][name] = value
|
||||||
|
|
||||||
# header
|
# header
|
||||||
def showing_header(self):
|
def showing_header(self):
|
||||||
return self.header != 0
|
return self.header != 0
|
||||||
|
|
Loading…
Reference in New Issue