[vim/vim] Vim startup with text immediately selected sometimes doesn't show "-- VISUAL --" (Issue #16620)

14 views
Skip to first unread message

Yee Cheng Chin

unread,
Feb 12, 2025, 1:39:19 AM2/12/25
to vim/vim, Subscribed

Steps to reproduce

This is a pretty minor bug but I found it during revamping test cases (in Test_visual_hl_with_showbreak in test_visual.vim), as it has a chance to fail screen dumps. It's a little inconsistent because it's subject to timing.

Steps:

  1. Make a file (bug_repro.vim) with the following:
    sleep 200m
    call setline(1, 'aaaaabbbbccccdddd')
    normal v4l
    
  2. Run Vim with vim --clean -S bug_repro.vim.
  3. Note that the launched Vim sometimes doesn't show -- VISUAL -- at bottom.

This doesn't happen all the time. I find that it's a lot easier to trigger using an ASAN build (build Vim using SANITIZER_CFLAGS="-g3 -O0 -DABORT_ON_INTERNAL_ERROR -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" env var) as this build is slower and more prone to this timing issue.

Expected behaviour

It should look like this (with the -- VISUAL --):

image.png (view on web)

With this bug it will look like this:

image.png (view on web)

Once you unselect and reselect the text, -- VISUAL -- will show up. Calling redraw in the sourced script will also properly draw it as well.

Version of Vim

9.1.1101

Environment

OS: macOS 15.3
Terminal: Apple Terminal
Shell: ZSH

Logs and stack traces


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

zeertzjq

unread,
Mar 21, 2026, 7:42:37 PM (3 days ago) Mar 21
to vim/vim, Subscribed
zeertzjq left a comment (vim/vim#16620)

I think this happens because escape sequences from the terminal cause the char_avail() in skip_showmode() to return TRUE:

    int
skip_showmode(void)
{
    // Call char_avail() only when we are going to show something, because it
    // takes a bit of time.  redrawing() may also call char_avail().
    if (global_busy
	    || msg_silent != 0
	    || !redrawing()
	    || (char_avail() && !KeyTyped))
    {
	redraw_mode = TRUE;		// show mode later
	return TRUE;
    }
    return FALSE;
}

Not sure how to solve this.


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/issues/16620/4104885679@github.com>

h_east

unread,
Mar 23, 2026, 7:25:25 AM (yesterday) Mar 23
to vim/vim, Subscribed
h-east left a comment (vim/vim#16620)

@ychin Could you check if the issue has been resolved through the PR?


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/issues/16620/4109899514@github.com>

Christian Brabandt

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

Closed #16620 as completed 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/issue/16620/issue_event/23865897453@github.com>

Reply all
Reply to author
Forward
0 new messages