[vim/vim] Fix "-- VISUAL --" not shown when terminal responses are pending (PR #19801)

3 views
Skip to first unread message

h_east

unread,
Mar 23, 2026, 7:22:09 AM (yesterday) Mar 23
to vim/vim, Subscribed

When starting Vim with a script that enters Visual mode (e.g. "vim -S script.vim"), the "-- VISUAL --" mode message sometimes doesn't appear. This happens because skip_showmode() calls char_avail(), which reads raw terminal input and picks up terminal response escape sequences (e.g. t_RV response). Combined with !KeyTyped (which is TRUE after script execution), this causes skip_showmode() to return TRUE, preventing the mode from being displayed.

Fix this by checking only the stuff buffer and typeahead buffer for pending characters, instead of char_avail() which also reads raw terminal input. This way, terminal response sequences no longer interfere with mode display.

closes: #16620


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19801

Commit Summary

  • ba228e7 Fix "-- VISUAL --" not shown when terminal responses are pending

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19801@github.com>

Christian Brabandt

unread,
Mar 23, 2026, 2:45:10 PM (yesterday) Mar 23
to vim/vim, Subscribed

@chrisbra commented on this pull request.


In src/screen.c:

>      if (global_busy
 	    || msg_silent != 0
 	    || !redrawing()
-	    || (char_avail() && !KeyTyped))
+	    || ((!stuff_empty() || typebuf.tb_len > 0) && !KeyTyped))

Hm, should it be:

⬇️ Suggested change
-	    || ((!stuff_empty() || typebuf.tb_len > 0) && !KeyTyped))
+	    || ((!stuff_empty() || typebuf.tb_len > 0 || using_script()) && !KeyTyped))


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19801/review/3993866700@github.com>

h_east

unread,
Mar 23, 2026, 2:53:46 PM (yesterday) Mar 23
to vim/vim, Subscribed

@h-east commented on this pull request.


In src/screen.c:

>      if (global_busy
 	    || msg_silent != 0
 	    || !redrawing()
-	    || (char_avail() && !KeyTyped))
+	    || ((!stuff_empty() || typebuf.tb_len > 0) && !KeyTyped))

Right. Thanks.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19801/review/3993914500@github.com>

h_east

unread,
Mar 23, 2026, 2:53:56 PM (yesterday) Mar 23
to vim/vim, Push

@h-east pushed 1 commit.


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19801/before/ba228e7d591add18ad98baa6135af14d8cafe346/after/f0a61790089e47ebc9efbcd40cbe5c1f63313a25@github.com>

h_east

unread,
Mar 23, 2026, 3:29:37 PM (yesterday) Mar 23
to vim/vim, Push

@h-east pushed 1 commit.

  • c9575dc Tweaking line breaks and function comments


View it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19801/before/f0a61790089e47ebc9efbcd40cbe5c1f63313a25/after/c9575dccc145d417c7338e9c3314c0cb8e10b19c@github.com>

Christian Brabandt

unread,
4:06 PM (7 hours ago) 4:06 PM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#19801)

thanks


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19801/c4121029475@github.com>

Christian Brabandt

unread,
4:12 PM (7 hours ago) 4:12 PM
to vim/vim, Subscribed

Closed #19801 via 9a2260d.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19801/issue_event/23865897599@github.com>

Reply all
Reply to author
Forward
0 new messages