bugfixes and some restructuring

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-06-28 04:33:25 +00:00
parent c104583d90
commit 8c09178d08
2 changed files with 36 additions and 33 deletions

View File

@ -446,14 +446,47 @@ class Application(object):
# full screen drawer
def draw(self):
self.hide_cursor()
self.draw_slots()
self.draw_input_bar()
self.draw_cursor()
self.hide_cursor()
self.win.noutrefresh()
self.hide_cursor()
curses.doupdate()
def draw_cursor(self):
if self.mini_active:
b = self.mini_buffer
w = b.windows[0]
(cx, cy) = w.logical_cursor().xy()
if cy >= len(b.lines):
return
elif cx == len(b.lines[cy]):
c = ' '
else:
c = b.lines[cy][cx]
self.win.addch(self.y-1, cx + len(self.mini_prompt), c, curses.A_REVERSE)
self.win.move(self.y-1, cx + len(self.mini_prompt))
else:
slot = self.bufferlist.slots[self.active_slot]
w = slot.window
if w.active_point is not None and w.point_is_visible(w.active_point):
p = w.active_point
else:
p = w.logical_cursor()
count = 0
(x, y) = w.first.xy()
while count < slot.height:
if p.y == y and p.x >= x and p.x <= x + slot.width:
self.highlight_char(slot.offset + count, p.x - x)
break
if x + slot.width >= len(w.buffer.lines[y]):
x = 0
y += 1
else:
x += slot.width
count += 1
self.win.move(slot.offset + count, p.x - x)
# sub-drawing methods
def draw_slots(self):
self.win.erase()
@ -521,24 +554,6 @@ class Application(object):
attr = color.build('default', shade, 'bold')
self.win.addch(j + slot.offset, limit, char, attr)
if self.mini_active is False and self.active_slot == i:
if w.active_point is not None and w.point_is_visible(w.active_point):
p = w.active_point
else:
p = w.logical_cursor()
count = 0
(x, y) = w.first.xy()
while count < slot.height:
if p.y == y and p.x >= x and p.x <= x + slot.width:
self.highlight_char(slot.offset + count, p.x - x)
break
if x + slot.width >= len(w.buffer.lines[y]):
x = 0
y += 1
else:
x += slot.width
count += 1
def _draw_slot_raw(self, i):
slot = self.bufferlist.slots[i]
w = slot.window
@ -692,17 +707,6 @@ class Application(object):
s2 = util.padtrunc(s1, l)
self.win.addnstr(self.y-1, 0, s2, l)
if self.mini_active:
w = b.windows[0]
cursor = w.logical_cursor()
(cx, cy) = cursor.xy()
if cy >= len(b.lines):
return
elif cx == len(b.lines[cy]):
c = ' '
else:
c = b.lines[cy][cx]
self.win.addch(self.y-1, cx + len(self.mini_prompt), c, curses.A_REVERSE)
def draw_nothing(self):
l = self.x - 1
self.win.addnstr(self.y-1, 0, util.pad('', l), l)

View File

@ -146,7 +146,6 @@ class PythonTabber(tab2.StackTabber):
elif token.string in ('elif', 'else') and self.is_leftmost_token(y, i):
# we know we'll unindent at least to the first if/elif
if not self.popped and not self.last_popped:
raise Exception, "junka"
self._pop_until('if', 'elif')
currlvl = self.get_curr_level()
self._append(token.string, currlvl + 4)