Skip to content

Commit

Permalink
fix wrapping for delete, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
haliphax committed Feb 27, 2021
1 parent f17ab21 commit 4c0c3c9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions xthulu/ui/editors.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,13 @@ def process_keystroke(self, ks):
after = after[1:]
self.value[self.pos[1]] = before + after
after = after[:min(len(after), self.columns - self.cursor[0])]

if self.cursor[0] + len(after) <= self.columns - 1:
after += ' '

log.debug(f'delete "{self.value[self.pos[1]]}"')

return self._color(after + ' ' +
self.term.move_x(self.cursor[0] + 1))
return self._color(after + self.term.move_left(len(after)))

elif ks.code == self.term.KEY_LEFT:
if self.cursor[0] <= 0 and self.pos[0] <= 0:
Expand Down Expand Up @@ -293,7 +296,7 @@ def process_keystroke(self, ks):
log.debug('shifting visible area right')

prev = self.cursor[0]
self.cursor[0] = min(strlen, self.columns - 1)
self.cursor[0] = min(strlen - self.pos[0], self.columns - 1)
log.debug(f'end {self.pos}')

return self.redraw(anchor=True) if shift \
Expand Down

0 comments on commit 4c0c3c9

Please sign in to comment.