Closed eugulixes closed 7 years ago
ping @eugulixes,
Moreover, it has a bug: cub1 moves the cursor one line up when the cursor is not at the left-most position.
Could you please specify this moment. I think that the existing implementation doesn't have this bag.
self._cur_x = max(0, self._cur_x - 1)
if self._cur_x == self._left_most: # we scroll up only when the cursor reaches the left most position
@dshil, this is the way how _cap_cub1
looked like
def _cap_cub1(self):
"""Moves the cursor left by 1 position.
Usually the method acts as a handler for a Backspace key-press.
"""
self._cur_x = max(0, self._cur_x - 1)
if self._cur_x == self._left_most:
self._cur_x = self._right_most
self._cur_y = max(0, self._cur_y - 1)
self._eol = True
For example, _cur_x
is 1 before calling _cap_cub1
. Then, after calling _cap_cub1
_cur_x
is set to 0self._cur_x == self._left_most
is True_cur_x
is set to _right_most
(79 by default)
According to the specification[1],
cub1
moves the cursor left by 1 position. However, the current implementation of the capability moves the cursor one line up. Moreover, it has a bug:cub1
moves the cursor one line up when the cursor is not at the left-most position.[1] http://pubs.opengroup.org/onlinepubs/7908799/xcurses/terminfo.html