branch : pmacs2
This commit is contained in:
moculus 2009-02-01 03:34:43 +00:00
parent a46c0e8347
commit 8a77dafb42
3 changed files with 33 additions and 6 deletions

View File

@ -709,7 +709,6 @@ class Application(object):
p = w.logical_cursor()
blen = len(w.buffer.lines)
#count = 0
count = w.mode.header #XYZ
(x, y) = w.first.xy()
(vy, vx) = (None, None)

View File

@ -67,6 +67,7 @@ class Buffer(object):
self.nl = '\n'
self.modified = False
self.highlights = {}
self.settings = {}
self.indentlvl = 4
self.writetabs = False
@ -161,6 +162,8 @@ class Buffer(object):
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)
if modename not in self.settings:
self.settings[modename] = {}
def remove_window(self, w):
if w in self.windows:

View File

@ -100,11 +100,19 @@ class Fundamental(Handler):
completers = {}
format = "%(flag)s %(bname)-18s (%(mname)s) %(indent)s %(cursor)s/%(mark)s %(perc)s"
# margins
header = 0
footer = 0
lmargin = 0
rmargin = 1
## margins
def get_header(self): return self.get_setting('header')
def set_header(self, value): return self.set_setting('header', value)
header = property(get_header, set_header)
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):
app.setmode(cls.modename.lower(), cls, paths=cls.paths,
@ -148,6 +156,12 @@ class Fundamental(Handler):
self.window = w
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
self.add_bindings('start-of-line', ('C-a', 'HOME',))
self.add_bindings('end-of-line', ('C-e', 'END',))
@ -258,6 +272,17 @@ class Fundamental(Handler):
if self.tabbercls:
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
def showing_header(self):
return self.header != 0