Skip to content

Commit 678f1e7

Browse files
committed
feat: enable modal cursor shape in vi mode
When vi = True, users expect the cursor to reflect modal state (block in NORMAL, beam in INSERT, underline in REPLACE). ModalCursorShapeConfig exists in prompt_toolkit for exactly this. Without it, cursor=None resolves to CursorShape._NEVER_CHANGE, so no DECSCUSR sequences are ever written regardless of mode.
1 parent d0a6cc2 commit 678f1e7

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

pgcli/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
)
4949
from prompt_toolkit.history import FileHistory
5050
from prompt_toolkit.auto_suggest import AutoSuggestFromHistory
51+
from prompt_toolkit.cursor_shapes import ModalCursorShapeConfig
5152
from pygments.lexers.sql import PostgresLexer
5253

5354
from pgspecial.main import PGSpecial, NO_QUERY, PAGER_OFF, PAGER_LONG_OUTPUT
@@ -1087,6 +1088,7 @@ def get_continuation(width, line_number, is_soft_wrap):
10871088
enable_suspend=True,
10881089
editing_mode=EditingMode.VI if self.vi_mode else EditingMode.EMACS,
10891090
search_ignore_case=True,
1091+
cursor=ModalCursorShapeConfig(),
10901092
)
10911093

10921094
return prompt_app

0 commit comments

Comments
 (0)