self.taint()
self._sizes = sizes
- def make_x_scroll(self, padchar: str, cursor_x: int, left: str, right: str
- ) -> tuple[int, str]:
+ def _make_x_scroll(self, padchar: str, cursor_x: int, left: str, right: str
+ ) -> tuple[int, str]:
'Build line of static left, right scrolled with cursor_x if too large.'
- to_write = left
+ to_write = left[:]
offset = 0
- width_gap = self._sizes.x - len(left) - len(right)
+ width_gap = self._sizes.x - len(left + right)
if width_gap < 0:
half_width = (self._sizes.x - len(left)) // 2
if cursor_x > half_width:
self._input_buffer_unsafe = content[:]
def _draw(self) -> None:
- prefix = self.prefix[:]
content = self.input_buffer
if self._cursor_x == len(self.input_buffer):
content += ' '
- x_cursor, to_write = self.make_x_scroll(padchar=' ',
- cursor_x=self._cursor_x,
- left=prefix,
- right=content)
+ x_cursor, to_write = self._make_x_scroll(padchar=' ',
+ cursor_x=self._cursor_x,
+ left=self.prefix[:],
+ right=content)
self._write(self._sizes.y,
FormattingString(to_write[:x_cursor])
+ FormattingString(to_write[x_cursor]).attrd('reverse')
def _draw(self) -> None:
cursor_x = 0
- focused = None
+ focus = None
win_listing = ''
for w in self._windows:
win_listing += ' ' if w.idx > 0 else '('
if w.history.has_unread_highlight:
item = f'*{item}'
if w.idx == self.idx_focus:
- focused = w
+ focus = w
item = f'[{item}]'
cursor_x = len(win_listing) + (len(item) // 2)
win_listing += item
- assert isinstance(focused, Window)
- self._write(self._sizes.y, self.make_x_scroll(padchar='=',
- cursor_x=cursor_x,
- left=focused.title + ')',
- right=win_listing)[1])
+ assert isinstance(focus, Window)
+ self._write(self._sizes.y, self._make_x_scroll(padchar='=',
+ cursor_x=cursor_x,
+ left=focus.title + ')',
+ right=win_listing)[1])
class Window: