File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 4545 from prompt_toolkit .eventloop .defaults import use_asyncio_event_loop
4646
4747from prompt_toolkit .completion import Completer , Completion
48+ from prompt_toolkit .cursor_shapes import ModalCursorShapeConfig
4849from prompt_toolkit .document import Document
4950from prompt_toolkit .enums import DEFAULT_BUFFER , EditingMode
5051from prompt_toolkit .filters import (
@@ -321,6 +322,19 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable):
321322 help = "Display the current vi mode (when using vi editing mode)."
322323 ).tag (config = True )
323324
325+ modal_cursor = Bool (
326+ False , help = "Changes cursor shape depending on vi mode"
327+ ).tag (config = True )
328+
329+ ttimeoutlen = Float (
330+ 0.01 ,
331+ config = True ,
332+ help = (
333+ "When to flush the input (For flushing escape keys.);"
334+ " like Vim’s ttimeoutlen option"
335+ )
336+ )
337+
324338 highlight_matching_brackets = Bool (True , help = "Highlight matching brackets." ,).tag (
325339 config = True
326340 )
@@ -572,8 +586,12 @@ def _(event):
572586 style = style ,
573587 input_processors = input_processors ,
574588 color_depth = (ColorDepth .TRUE_COLOR if self .true_color else None ),
589+ cursor = ModalCursorShapeConfig () if self .modal_cursor else None ,
575590 )
576591
592+ if self .modal_cursor :
593+ self .pt_cli .app .ttimeoutlen = self .ttimeoutlen
594+
577595 async def prompt_for_code (self ):
578596 if self .next_input :
579597 default = self .next_input
You can’t perform that action at this time.
0 commit comments