File tree 2 files changed +16
-2
lines changed
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -436,6 +436,11 @@ def __init__(
436
436
# default, we don't change them.)
437
437
self ._cursor_shape_changed = False
438
438
439
+ # Don't hide/show the cursor when this was already done.
440
+ # (`None` means that we don't know whether the cursor is visible or
441
+ # not.)
442
+ self ._cursor_visible : bool | None = None
443
+
439
444
@classmethod
440
445
def from_pty (
441
446
cls ,
@@ -651,10 +656,14 @@ def cursor_backward(self, amount: int) -> None:
651
656
self .write_raw ("\x1b [%iD" % amount )
652
657
653
658
def hide_cursor (self ) -> None :
654
- self .write_raw ("\x1b [?25l" )
659
+ if self ._cursor_visible in (True , None ):
660
+ self ._cursor_visible = False
661
+ self .write_raw ("\x1b [?25l" )
655
662
656
663
def show_cursor (self ) -> None :
657
- self .write_raw ("\x1b [?12l\x1b [?25h" ) # Stop blinking cursor and show.
664
+ if self ._cursor_visible in (False , None ):
665
+ self ._cursor_visible = True
666
+ self .write_raw ("\x1b [?12l\x1b [?25h" ) # Stop blinking cursor and show.
658
667
659
668
def set_cursor_shape (self , cursor_shape : CursorShape ) -> None :
660
669
if cursor_shape == CursorShape ._NEVER_CHANGE :
Original file line number Diff line number Diff line change @@ -353,6 +353,11 @@ def __init__(
353
353
self .mouse_support = to_filter (mouse_support )
354
354
self .cpr_not_supported_callback = cpr_not_supported_callback
355
355
356
+ # TODO: Move following state flags into `Vt100_Output`, similar to
357
+ # `_cursor_shape_changed` and `_cursor_visible`. But then also
358
+ # adjust the `Win32Output` to not call win32 APIs if nothing has
359
+ # to be changed.
360
+
356
361
self ._in_alternate_screen = False
357
362
self ._mouse_support_enabled = False
358
363
self ._bracketed_paste_enabled = False
You can’t perform that action at this time.
0 commit comments