diff --git a/curtsies/window.py b/curtsies/window.py index 41ce4e1..e5dd8a3 100644 --- a/curtsies/window.py +++ b/curtsies/window.py @@ -200,7 +200,7 @@ def render_to_terminal( current_lines_by_row[row] = line if line == self._last_lines_by_row.get(row, None): continue - self.write(self.t.move(row, 0)) + self.write(self.t.move_yx(row, 0)) self.write(for_stdout(line)) if len(line) < width: self.write(self.t.clear_eol) @@ -209,14 +209,14 @@ def render_to_terminal( for row in range(len(array), height): if self._last_lines_by_row and row not in self._last_lines_by_row: continue - self.write(self.t.move(row, 0)) + self.write(self.t.move_yx(row, 0)) self.write(self.t.clear_eol) self.write(self.t.clear_bol) current_lines_by_row[row] = None logger.debug("lines in last lines by row: %r" % self._last_lines_by_row.keys()) logger.debug("lines in current lines by row: %r" % current_lines_by_row.keys()) - self.write(self.t.move(*cursor_pos)) + self.write(self.t.move_yx(*cursor_pos)) self._last_lines_by_row = current_lines_by_row if not self.hide_cursor: self.write(self.t.normal_cursor) @@ -299,7 +299,10 @@ def __exit__( # just moves cursor down if not on last line self.write(self.t.move_down) - self.write(self.t.move_x(0)) + # Blessed's Terminal.move_x doesn't type this, see + # https://github.com/jquast/blessed/blob/master/tox.ini#L121-L130 + move_x = cast(Callable[[int], str], self.t.move) + self.write(move_x(0)) self.write(self.t.clear_eos) self.write(self.t.clear_eol) self.cbreak.__exit__(type, value, traceback) @@ -467,7 +470,7 @@ def render_to_terminal( current_lines_by_row[row] = line if line == self._last_lines_by_row.get(row, None): continue - self.write(self.t.move(row, 0)) + self.write(self.t.move_yx(row, 0)) self.write(for_stdout(line)) if len(line) < width: self.write(self.t.clear_eol) @@ -478,7 +481,7 @@ def render_to_terminal( for row in rest_of_rows: # if array too small if self._last_lines_by_row and row not in self._last_lines_by_row: continue - self.write(self.t.move(row, 0)) + self.write(self.t.move_yx(row, 0)) self.write(self.t.clear_eol) # TODO probably not necessary - is first char cleared? self.write(self.t.clear_bol) @@ -495,7 +498,7 @@ def render_to_terminal( current_lines_by_row = {k - 1: v for k, v in current_lines_by_row.items()} logger.debug("new top_usable_row: %d" % self.top_usable_row) # since scrolling moves the cursor - self.write(self.t.move(height - 1, 0)) + self.write(self.t.move_yx(height - 1, 0)) self.write(for_stdout(line)) current_lines_by_row[height - 1] = line @@ -505,7 +508,7 @@ def render_to_terminal( 0, cursor_pos[0] - offscreen_scrolls + self.top_usable_row ) self._last_cursor_column = cursor_pos[1] - self.write(self.t.move(self._last_cursor_row, self._last_cursor_column)) + self.write(self.t.move_yx(self._last_cursor_row, self._last_cursor_column)) self._last_lines_by_row = current_lines_by_row if not self.hide_cursor: self.write(self.t.normal_cursor)