From dd37bf139b4019b4c557c38f871641b2c00c8213 Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Sat, 3 Jul 2010 23:08:15 -0400 Subject: [PATCH] maybe editing with tabs actually works now? --HG-- branch : pmacs2 --- application.py | 3 +-- render.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/application.py b/application.py index d62f59e..8837970 100755 --- a/application.py +++ b/application.py @@ -796,7 +796,7 @@ class Application(object): while count < slot.height: 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: vy, vx = slot.y_offset + count, p.x - x + w.mode.lmargin @@ -831,7 +831,6 @@ class Application(object): else: slot = self.bufferlist.slots[self.active_slot] 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): p = w.active_point else: diff --git a/render.py b/render.py index 6821383..d78ff78 100644 --- a/render.py +++ b/render.py @@ -26,18 +26,18 @@ class RenderString(object): if attrs is None: attrs = color.build('default', 'default') - self.string = s - self.string.replace('\t', ' ') + #self.string = s + self.string = s.replace('\t', ' ') self.y = y self.x = x self.attrs = attrs def width(self, w): l = len(self.string) - #l += self.string.count('\t') * (w.mode.tabwidth - 1) return l def draw(self, cwin, y, x): try: s = self.string.encode('utf-8') + assert '\t' not in s, repr(s) cwin.addstr(self.y + y, x, s, self.attrs) except curses.error: raise