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 45
45
from prompt_toolkit .eventloop .defaults import use_asyncio_event_loop
46
46
47
47
from prompt_toolkit .completion import Completer , Completion
48
+ from prompt_toolkit .cursor_shapes import ModalCursorShapeConfig
48
49
from prompt_toolkit .document import Document
49
50
from prompt_toolkit .enums import DEFAULT_BUFFER , EditingMode
50
51
from prompt_toolkit .filters import (
@@ -321,6 +322,19 @@ class ZMQTerminalInteractiveShell(SingletonConfigurable):
321
322
help = "Display the current vi mode (when using vi editing mode)."
322
323
).tag (config = True )
323
324
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
+
324
338
highlight_matching_brackets = Bool (True , help = "Highlight matching brackets." ,).tag (
325
339
config = True
326
340
)
@@ -572,8 +586,12 @@ def _(event):
572
586
style = style ,
573
587
input_processors = input_processors ,
574
588
color_depth = (ColorDepth .TRUE_COLOR if self .true_color else None ),
589
+ cursor = ModalCursorShapeConfig () if self .modal_cursor else None ,
575
590
)
576
591
592
+ if self .modal_cursor :
593
+ self .pt_cli .app .ttimeoutlen = self .ttimeoutlen
594
+
577
595
async def prompt_for_code (self ):
578
596
if self .next_input :
579
597
default = self .next_input
You can’t perform that action at this time.
0 commit comments