parent
85a067f5f3
commit
84c9dad374
5
BUGS
5
BUGS
|
@ -1,5 +1,10 @@
|
||||||
=== OUSTANDING BUGS ===
|
=== OUSTANDING BUGS ===
|
||||||
|
|
||||||
|
2009/01/28:
|
||||||
|
completion-buffer needs to save window, instead of just saving
|
||||||
|
the buffer. otherwise you lose window-customization (e.g. margins, headers,
|
||||||
|
etc).
|
||||||
|
|
||||||
2008/12/13:
|
2008/12/13:
|
||||||
python mode needs to not indent "if foo: bar()" lines.
|
python mode needs to not indent "if foo: bar()" lines.
|
||||||
|
|
||||||
|
|
6
IDEAS
6
IDEAS
|
@ -1,3 +1,9 @@
|
||||||
|
2009/01/28:
|
||||||
|
|
||||||
|
Move modes into buffers and out of windows. This should reduce the memory
|
||||||
|
footprint a little bit, as well as fixing some weird bugs and making some
|
||||||
|
interfaces more consistent.
|
||||||
|
|
||||||
2008/09/21:
|
2008/09/21:
|
||||||
|
|
||||||
Tab completion, paren matching, and scope detection should be done by one module
|
Tab completion, paren matching, and scope detection should be done by one module
|
||||||
|
|
|
@ -327,6 +327,7 @@ class Application(object):
|
||||||
blist.set_slot(i, blist.hidden_buffers[0])
|
blist.set_slot(i, blist.hidden_buffers[0])
|
||||||
else:
|
else:
|
||||||
blist.set_slot(i, active_slot.window.buffer)
|
blist.set_slot(i, active_slot.window.buffer)
|
||||||
|
assert blist.slots[i].window is not None
|
||||||
|
|
||||||
def open_path(self, path, binary=False, cipher=None, password=None):
|
def open_path(self, path, binary=False, cipher=None, password=None):
|
||||||
path = os.path.abspath(os.path.realpath(util.expand_tilde(path)))
|
path = os.path.abspath(os.path.realpath(util.expand_tilde(path)))
|
||||||
|
@ -708,7 +709,8 @@ class Application(object):
|
||||||
p = w.logical_cursor()
|
p = w.logical_cursor()
|
||||||
|
|
||||||
blen = len(w.buffer.lines)
|
blen = len(w.buffer.lines)
|
||||||
count = 0
|
#count = 0
|
||||||
|
count = w.mode.header #XYZ
|
||||||
(x, y) = w.first.xy()
|
(x, y) = w.first.xy()
|
||||||
(vy, vx) = (None, None)
|
(vy, vx) = (None, None)
|
||||||
while count < slot.height:
|
while count < slot.height:
|
||||||
|
@ -752,7 +754,8 @@ class Application(object):
|
||||||
for x in range(sx1, sx2):
|
for x in range(sx1, sx2):
|
||||||
self.highlight_char(sy, x, fg, bg)
|
self.highlight_char(sy, x, fg, bg)
|
||||||
|
|
||||||
def map_point(self, p):
|
# NOTE: this is totally broken
|
||||||
|
def map_point(self, w, p):
|
||||||
count = 0
|
count = 0
|
||||||
x, y = w.first.xy()
|
x, y = w.first.xy()
|
||||||
while count < slot.height:
|
while count < slot.height:
|
||||||
|
@ -776,13 +779,21 @@ class Application(object):
|
||||||
w = slot.window
|
w = slot.window
|
||||||
modename = w.mode.name()
|
modename = w.mode.name()
|
||||||
|
|
||||||
|
# XYZ
|
||||||
|
rstrs = w.mode.get_header(w)
|
||||||
|
assert len(rstrs) >= w.mode.header
|
||||||
|
for i in range(0, w.mode.header):
|
||||||
|
rstrs[i].draw(self.win, slot.y_offset + i, slot.x_offset)
|
||||||
|
# XYZ
|
||||||
|
|
||||||
self._draw_slot(i)
|
self._draw_slot(i)
|
||||||
|
|
||||||
# highlighted regions
|
# highlighted regions
|
||||||
for hr in self.highlighted_ranges:
|
for hr in self.highlighted_ranges:
|
||||||
(high_w, p1, p2, fg, bg) = hr
|
(high_w, p1, p2, fg, bg) = hr
|
||||||
if w is high_w and p2 >= w.first and p1 <= w.last:
|
if w is high_w and p2 >= w.first and p1 <= w.last:
|
||||||
count = 0
|
#count = 0
|
||||||
|
count = w.mode.header #XYZ
|
||||||
x, y = w.first.xy()
|
x, y = w.first.xy()
|
||||||
px = p1.x
|
px = p1.x
|
||||||
while count < slot.height:
|
while count < slot.height:
|
||||||
|
@ -817,7 +828,8 @@ class Application(object):
|
||||||
x, y = w.first.xy()
|
x, y = w.first.xy()
|
||||||
lm, rm = w.mode.lmargin, w.mode.rmargin
|
lm, rm = w.mode.lmargin, w.mode.rmargin
|
||||||
lines = w.buffer.lines
|
lines = w.buffer.lines
|
||||||
count = 0
|
#count = 0
|
||||||
|
count = w.mode.header #XYZ
|
||||||
k = x // (slot.width - lm - rm)
|
k = x // (slot.width - lm - rm)
|
||||||
modename = w.mode.name()
|
modename = w.mode.name()
|
||||||
lit = w.mode.name() in w.buffer.highlights
|
lit = w.mode.name() in w.buffer.highlights
|
||||||
|
|
|
@ -1006,9 +1006,18 @@ class SetConfigVariable(Method):
|
||||||
else:
|
else:
|
||||||
w.set_error("previously unset param %r set to %r" % (name, value))
|
w.set_error("previously unset param %r set to %r" % (name, value))
|
||||||
|
|
||||||
|
class ToggleHeader(Method):
|
||||||
|
def _execute(self, w, **vargs):
|
||||||
|
if w.mode.showing_header():
|
||||||
|
w.mode.disable_header()
|
||||||
|
w.set_error('Header hidden')
|
||||||
|
else:
|
||||||
|
w.mode.enable_header()
|
||||||
|
w.set_error('Header visible')
|
||||||
|
|
||||||
class ToggleLineNumbers(Method):
|
class ToggleLineNumbers(Method):
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
if w.mode.show_line_numbers:
|
if w.mode.showing_line_numbers():
|
||||||
w.mode.disable_line_numbers()
|
w.mode.disable_line_numbers()
|
||||||
w.set_error('Line numbers hidden')
|
w.set_error('Line numbers hidden')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -100,8 +100,9 @@ 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"
|
||||||
|
|
||||||
# margin/line numbering
|
# margins
|
||||||
show_line_numbers = False
|
header = 0
|
||||||
|
footer = 0
|
||||||
lmargin = 0
|
lmargin = 0
|
||||||
rmargin = 1
|
rmargin = 1
|
||||||
|
|
||||||
|
@ -257,14 +258,30 @@ class Fundamental(Handler):
|
||||||
if self.tabbercls:
|
if self.tabbercls:
|
||||||
self.tabber = self.tabbercls(self)
|
self.tabber = self.tabbercls(self)
|
||||||
|
|
||||||
|
# header
|
||||||
|
def showing_header(self):
|
||||||
|
return self.header != 0
|
||||||
|
def enable_header(self):
|
||||||
|
self.header = 1
|
||||||
|
def disable_header(self):
|
||||||
|
self.header = 0
|
||||||
|
|
||||||
|
# line numbers
|
||||||
|
def showing_line_numbers(self):
|
||||||
|
return self.lmargin != 0
|
||||||
def enable_line_numbers(self):
|
def enable_line_numbers(self):
|
||||||
self.show_line_numbers = True
|
|
||||||
l = len(self.window.buffer.lines)
|
l = len(self.window.buffer.lines)
|
||||||
self.lmargin = int(math.log(l, 10)) + 3
|
self.lmargin = int(math.log(l, 10)) + 3
|
||||||
def disable_line_numbers(self):
|
def disable_line_numbers(self):
|
||||||
self.show_line_numbers = False
|
|
||||||
self.lmargin = 0
|
self.lmargin = 0
|
||||||
|
|
||||||
|
# headers and margins
|
||||||
|
def get_header(self, w):
|
||||||
|
fg, bg = "default", "red"
|
||||||
|
return [RenderString(s='header', attrs=color.build(fg, bg))]
|
||||||
|
def get_footer(self, w):
|
||||||
|
fg, bg = "default", "red"
|
||||||
|
return [RenderString(s='footer', attrs=color.build(fg, bg))]
|
||||||
def get_rmargin(self, w, y, x, ended=False, cont=False):
|
def get_rmargin(self, w, y, x, ended=False, cont=False):
|
||||||
c, fg, bg = " ", "red", "default"
|
c, fg, bg = " ", "red", "default"
|
||||||
if cont:
|
if cont:
|
||||||
|
@ -388,6 +405,8 @@ class Fundamental(Handler):
|
||||||
self.tabber.region_added(p, newlines)
|
self.tabber.region_added(p, newlines)
|
||||||
if self.context is not None:
|
if self.context is not None:
|
||||||
self.context.region_added(p, newlines)
|
self.context.region_added(p, newlines)
|
||||||
|
if self.lmargin != 0:
|
||||||
|
self.enable_line_numbers()
|
||||||
|
|
||||||
def region_removed(self, p1, p2):
|
def region_removed(self, p1, p2):
|
||||||
if self.lexer is not None:
|
if self.lexer is not None:
|
||||||
|
@ -417,5 +436,7 @@ class Fundamental(Handler):
|
||||||
self.tabber.region_removed(p1, p2)
|
self.tabber.region_removed(p1, p2)
|
||||||
if self.context is not None:
|
if self.context is not None:
|
||||||
self.context.region_removed(p1, p2)
|
self.context.region_removed(p1, p2)
|
||||||
|
if self.lmargin != 0:
|
||||||
|
self.enable_line_numbers()
|
||||||
|
|
||||||
install = Fundamental.install
|
install = Fundamental.install
|
||||||
|
|
|
@ -5,6 +5,7 @@ from lex import Grammar, PatternRule, RegionRule, PatternGroupRule
|
||||||
from point import Point
|
from point import Point
|
||||||
from buffer import Buffer
|
from buffer import Buffer
|
||||||
from method import Method, Argument, arg
|
from method import Method, Argument, arg
|
||||||
|
import util
|
||||||
|
|
||||||
class LineGrammar(Grammar):
|
class LineGrammar(Grammar):
|
||||||
rules = [PatternRule(name=r'data', pattern=r'^.*\n$')]
|
rules = [PatternRule(name=r'data', pattern=r'^.*\n$')]
|
||||||
|
@ -171,7 +172,9 @@ class MboxOpenPath(Method):
|
||||||
args = [arg('mbox', dt="path", p="Open Mbox: ", dv=default.path_dirname,
|
args = [arg('mbox', dt="path", p="Open Mbox: ", dv=default.path_dirname,
|
||||||
ld=True, h="mbox to open")]
|
ld=True, h="mbox to open")]
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
b = MboxListBuffer(vargs['mbox'])
|
path = util.expand_tilde(vargs['mbox'])
|
||||||
|
path = os.path.abspath(os.path.realpath(path))
|
||||||
|
b = MboxListBuffer(path)
|
||||||
b.open()
|
b.open()
|
||||||
window.Window(b, w.application, height=0, width=0, mode_name='mbox')
|
window.Window(b, w.application, height=0, width=0, mode_name='mbox')
|
||||||
w.application.add_buffer(b)
|
w.application.add_buffer(b)
|
||||||
|
|
|
@ -49,7 +49,7 @@ class XmlValidate(method.shell.Exec):
|
||||||
self._doit(w, w.buffer.path, 'xmlwf %(path)r', cmdname='xml-validate')
|
self._doit(w, w.buffer.path, 'xmlwf %(path)r', cmdname='xml-validate')
|
||||||
|
|
||||||
class XmlCreateTag(method.Method):
|
class XmlCreateTag(method.Method):
|
||||||
''''''
|
'''Create an opening and closing tag'''
|
||||||
args = [method.Argument('tagname', prompt="Tag Name: ", help="Create an open/close tag pair")]
|
args = [method.Argument('tagname', prompt="Tag Name: ", help="Create an open/close tag pair")]
|
||||||
def _execute(self, w, **vargs):
|
def _execute(self, w, **vargs):
|
||||||
t = vargs['tagname']
|
t = vargs['tagname']
|
||||||
|
|
|
@ -17,9 +17,6 @@ from render import RenderString
|
||||||
# the shorter line will "set" the cursor to its position on the shorter line.
|
# the shorter line will "set" the cursor to its position on the shorter line.
|
||||||
|
|
||||||
class Window(object):
|
class Window(object):
|
||||||
#margins = ((80, 'blue'),)
|
|
||||||
#margin_limit = 80
|
|
||||||
#margin_color = 'blue'
|
|
||||||
margins_visible = False
|
margins_visible = False
|
||||||
def __init__(self, b, a, height=24, width=80, mode_name=None):
|
def __init__(self, b, a, height=24, width=80, mode_name=None):
|
||||||
self.buffer = b
|
self.buffer = b
|
||||||
|
@ -160,8 +157,8 @@ class Window(object):
|
||||||
def set_size(self, width, height):
|
def set_size(self, width, height):
|
||||||
assert type(width) == type(0), width
|
assert type(width) == type(0), width
|
||||||
assert type(height) == type(0), height
|
assert type(height) == type(0), height
|
||||||
self.width = width - self.mode.lmargin - self.mode.rmargin
|
self.width = width - self.mode.lmargin - self.mode.rmargin - 10
|
||||||
self.height = height
|
self.height = height - self.mode.header - self.mode.footer
|
||||||
self.redraw()
|
self.redraw()
|
||||||
|
|
||||||
# region added
|
# region added
|
||||||
|
|
Loading…
Reference in New Issue