maybe editing with tabs actually works now?

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2010-07-03 23:08:15 -04:00
parent ff77879a81
commit dd37bf139b
2 changed files with 4 additions and 5 deletions

View File

@ -796,7 +796,7 @@ class Application(object):
while count < slot.height: while count < slot.height:
line = w.buffer.lines[y] line = w.buffer.lines[y]
l = len(line) + line.count('\t') * (w.mode.tabwidth - 1) l = len(line)
if p.y == y and p.x >= x and p.x <= x + swidth: if p.y == y and p.x >= x and p.x <= x + swidth:
vy, vx = slot.y_offset + count, p.x - x + w.mode.lmargin vy, vx = slot.y_offset + count, p.x - x + w.mode.lmargin
@ -831,7 +831,6 @@ class Application(object):
else: else:
slot = self.bufferlist.slots[self.active_slot] slot = self.bufferlist.slots[self.active_slot]
w = slot.window w = slot.window
#swidth = slot.width - w.mode.lmargin - w.mode.rmargin
if w.active_point is not None and w.point_is_visible(w.active_point): if w.active_point is not None and w.point_is_visible(w.active_point):
p = w.active_point p = w.active_point
else: else:

View File

@ -26,18 +26,18 @@ class RenderString(object):
if attrs is None: if attrs is None:
attrs = color.build('default', 'default') attrs = color.build('default', 'default')
self.string = s #self.string = s
self.string.replace('\t', ' ') self.string = s.replace('\t', ' ')
self.y = y self.y = y
self.x = x self.x = x
self.attrs = attrs self.attrs = attrs
def width(self, w): def width(self, w):
l = len(self.string) l = len(self.string)
#l += self.string.count('\t') * (w.mode.tabwidth - 1)
return l return l
def draw(self, cwin, y, x): def draw(self, cwin, y, x):
try: try:
s = self.string.encode('utf-8') s = self.string.encode('utf-8')
assert '\t' not in s, repr(s)
cwin.addstr(self.y + y, x, s, self.attrs) cwin.addstr(self.y + y, x, s, self.attrs)
except curses.error: except curses.error:
raise raise