diff options
author | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-08 15:26:58 +0300 |
---|---|---|
committer | arcadia-devtools <arcadia-devtools@yandex-team.ru> | 2022-02-08 15:26:58 +0300 |
commit | 2efaaefec2cb2a55d55c01753d1eed2a3296adb5 (patch) | |
tree | 27ec5258b325565c3963b91b36d64e84084fdb04 /contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py | |
parent | 23793c5d0827a08b5ff9242d2123eff92b681912 (diff) | |
download | ydb-2efaaefec2cb2a55d55c01753d1eed2a3296adb5.tar.gz |
intermediate changes
ref:0bfa27bb6c38df8c510497e54e4ebf0b4fb84503
Diffstat (limited to 'contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py')
-rw-r--r-- | contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py index 9d8255d717..d670c3c57b 100644 --- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py +++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/renderer.py @@ -8,6 +8,7 @@ from enum import Enum from typing import TYPE_CHECKING, Any, Callable, Deque, Dict, Hashable, Optional, Tuple from prompt_toolkit.application.current import get_app +from prompt_toolkit.cursor_shapes import CursorShape from prompt_toolkit.data_structures import Point, Size from prompt_toolkit.filters import FilterOrBool, to_filter from prompt_toolkit.formatted_text import AnyFormattedText, to_formatted_text @@ -385,6 +386,7 @@ class Renderer: self._last_screen: Optional[Screen] = None self._last_size: Optional[Size] = None self._last_style: Optional[str] = None + self._last_cursor_shape: Optional[CursorShape] = None # Default MouseHandlers. (Just empty.) self.mouse_handlers = MouseHandlers() @@ -704,6 +706,16 @@ class Renderer: self._last_size = size self.mouse_handlers = mouse_handlers + # Handle cursor shapes. + new_cursor_shape = app.cursor.get_cursor_shape(app) + if ( + self._last_cursor_shape is None + or self._last_cursor_shape != new_cursor_shape + ): + output.set_cursor_shape(new_cursor_shape) + self._last_cursor_shape = new_cursor_shape + + # Flush buffered output. output.flush() # Set visible windows in layout. @@ -728,6 +740,8 @@ class Renderer: output.erase_down() output.reset_attributes() output.enable_autowrap() + output.reset_cursor_shape() + output.flush() self.reset(leave_alternate_screen=leave_alternate_screen) |