diff options
| author | Mattias Andrée <maandree@operamail.com> | 2013-09-10 09:41:14 +0200 |
|---|---|---|
| committer | Mattias Andrée <maandree@operamail.com> | 2013-09-10 09:41:14 +0200 |
| commit | 52a54d24be8e977af5bed63b51cad109515e3858 (patch) | |
| tree | ad9a01f27a09fae0085bcebc74cec9c5d505a426 | |
| parent | duplicate instruction (diff) | |
| download | pytagomacs-52a54d24be8e977af5bed63b51cad109515e3858.tar.gz pytagomacs-52a54d24be8e977af5bed63b51cad109515e3858.tar.bz2 pytagomacs-52a54d24be8e977af5bed63b51cad109515e3858.tar.xz | |
fix jump bug on text insert
Signed-off-by: Mattias Andrée <maandree@operamail.com>
| -rw-r--r-- | src/editor.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/editor.py b/src/editor.py index 78f7001..214a4d7 100644 --- a/src/editor.py +++ b/src/editor.py @@ -54,6 +54,8 @@ class Jump(): ''' def __init__(self, y, x): self.string = '\033[%i;%iH' % (y, x) + if (y < 0) or (x < 0): + raise Exception() ########################## ########################## ########################## ########################## ########################## def __str__(self): return self.string def __call__(self): @@ -408,7 +410,7 @@ class TextArea(): print('%s\033[%i@' % (self.jump(oldx - self.area.offx), len(insert)), end='') print(insert, end='') else: - self.area.offx = len(self.text) - self.area.areawidth + self.area.offx = self.area.x - self.area.areawidth // 4 self.jump(0)() print(' ' * self.area.areawidth, end='') self.draw() |
