Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a12e801

Browse filesBrowse files
authored
Add cursor shape indicator for vi mode (#1558)
* 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. * Add cursor shape indicator to vi mode changelog
1 parent d0a6cc2 commit a12e801
Copy full SHA for a12e801

2 files changed

+5Lines changed: 5 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎changelog.rst‎

Copy file name to clipboardExpand all lines: changelog.rst
+3Lines changed: 3 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Upcoming (TBD)
44
Features:
55
---------
66
* Add support for `\\T` prompt escape sequence to display transaction status (similar to psql's `%x`).
7+
* Add cursor shape support for vi mode. When ``vi = True``, the terminal cursor now
8+
reflects the current editing mode: beam in INSERT, block in NORMAL, underline in REPLACE.
9+
Uses prompt_toolkit's ``ModalCursorShapeConfig``.
710

811
4.4.0 (2025-12-24)
912
==================
Collapse file

‎pgcli/main.py‎

Copy file name to clipboardExpand all lines: pgcli/main.py
+2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.