Skip to content

Commit c086879

Browse files
Fix mypy types changed by blessed update
1 parent b2aaae8 commit c086879

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

curtsies/window.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ def render_to_terminal(
200200
current_lines_by_row[row] = line
201201
if line == self._last_lines_by_row.get(row, None):
202202
continue
203-
self.write(self.t.move(row, 0))
203+
self.write(self.t.move_yx(row, 0))
204204
self.write(for_stdout(line))
205205
if len(line) < width:
206206
self.write(self.t.clear_eol)
@@ -209,14 +209,14 @@ def render_to_terminal(
209209
for row in range(len(array), height):
210210
if self._last_lines_by_row and row not in self._last_lines_by_row:
211211
continue
212-
self.write(self.t.move(row, 0))
212+
self.write(self.t.move_yx(row, 0))
213213
self.write(self.t.clear_eol)
214214
self.write(self.t.clear_bol)
215215
current_lines_by_row[row] = None
216216

217217
logger.debug("lines in last lines by row: %r" % self._last_lines_by_row.keys())
218218
logger.debug("lines in current lines by row: %r" % current_lines_by_row.keys())
219-
self.write(self.t.move(*cursor_pos))
219+
self.write(self.t.move_yx(*cursor_pos))
220220
self._last_lines_by_row = current_lines_by_row
221221
if not self.hide_cursor:
222222
self.write(self.t.normal_cursor)
@@ -299,7 +299,10 @@ def __exit__(
299299
# just moves cursor down if not on last line
300300
self.write(self.t.move_down)
301301

302-
self.write(self.t.move_x(0))
302+
# Blessed's Terminal.move_x doesn't type this, see
303+
# https://github.com/jquast/blessed/blob/master/tox.ini#L121-L130
304+
move_x = cast(Callable[[int], str], self.t.move)
305+
self.write(move_x(0))
303306
self.write(self.t.clear_eos)
304307
self.write(self.t.clear_eol)
305308
self.cbreak.__exit__(type, value, traceback)
@@ -467,7 +470,7 @@ def render_to_terminal(
467470
current_lines_by_row[row] = line
468471
if line == self._last_lines_by_row.get(row, None):
469472
continue
470-
self.write(self.t.move(row, 0))
473+
self.write(self.t.move_yx(row, 0))
471474
self.write(for_stdout(line))
472475
if len(line) < width:
473476
self.write(self.t.clear_eol)
@@ -478,7 +481,7 @@ def render_to_terminal(
478481
for row in rest_of_rows: # if array too small
479482
if self._last_lines_by_row and row not in self._last_lines_by_row:
480483
continue
481-
self.write(self.t.move(row, 0))
484+
self.write(self.t.move_yx(row, 0))
482485
self.write(self.t.clear_eol)
483486
# TODO probably not necessary - is first char cleared?
484487
self.write(self.t.clear_bol)
@@ -495,7 +498,7 @@ def render_to_terminal(
495498
current_lines_by_row = {k - 1: v for k, v in current_lines_by_row.items()}
496499
logger.debug("new top_usable_row: %d" % self.top_usable_row)
497500
# since scrolling moves the cursor
498-
self.write(self.t.move(height - 1, 0))
501+
self.write(self.t.move_yx(height - 1, 0))
499502
self.write(for_stdout(line))
500503
current_lines_by_row[height - 1] = line
501504

@@ -505,7 +508,7 @@ def render_to_terminal(
505508
0, cursor_pos[0] - offscreen_scrolls + self.top_usable_row
506509
)
507510
self._last_cursor_column = cursor_pos[1]
508-
self.write(self.t.move(self._last_cursor_row, self._last_cursor_column))
511+
self.write(self.t.move_yx(self._last_cursor_row, self._last_cursor_column))
509512
self._last_lines_by_row = current_lines_by_row
510513
if not self.hide_cursor:
511514
self.write(self.t.normal_cursor)

0 commit comments

Comments
 (0)