Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor moves to commandline when searching for pattern (perceived as cursor flicker) #25980

Open
Asheq opened this issue Nov 11, 2023 · 9 comments · May be fixed by #29446
Open

Cursor moves to commandline when searching for pattern (perceived as cursor flicker) #25980

Asheq opened this issue Nov 11, 2023 · 9 comments · May be fixed by #29446
Labels
bug issues reporting wrong behavior complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md display redraw, layout, presentation performance issues reporting performance problems
Milestone

Comments

@Asheq
Copy link

Asheq commented Nov 11, 2023

Problem

The cursor briefly moves to the commandline when searching for the next pattern using:

  • n
  • N
  • *
  • #

In terminal nvim

In terminal nvim, this is perceived as a cursor flicker.

Screen.Recording.2023-11-10.at.8.25.30.PM.mov

In neovide (with cursor animation)

In neovide with cursor animation enabled, this is perceived as the cursor jumping across the screen and then back.

Screen.Recording.2023-11-10.at.8.29.27.PM.mov

Steps to reproduce

Open neovim:

nvim --clean

or

neovide -- --clean

Create new buffer in right window

:vnew
<C-w>l

Setup buffer to contain xyz on 10,000,000 lines and abc on line 1 and line 5,000,000

iabc<Esc>
oxyz<Esc>
yy10000000p
50%
Oabc<Esc>

Invoke search on abc:

*
n
N
#

Notice that cursor goes to commandline between searches.

Expected behavior

The cursor should not move to the commandline.

It should stay in the same screen position until the next search match location is found and then move there directly.

Neovim version (nvim -v)

NVIM v0.10.0-dev-1461+g468292dcb-Homebrew

Vim (not Nvim) behaves the same?

yes, vim 9.0.1544 (cursor disappears briefly as well but does not seem to appear in comandline)

Operating system/version

macOS 13.5.1

Terminal name/version

kitty 0.29.0

$TERM environment variable

xterm-kitty

Installation

homebrew

@Asheq Asheq added the bug issues reporting wrong behavior label Nov 11, 2023
@Asheq
Copy link
Author

Asheq commented Nov 11, 2023

PS: The reason that I created this as a separate issue from #25974 is because the cursor moves to the commandline for a different reason: in that issue it's because a message is being printed, whereas in this issue it appears to be because neovim is "resting" or "parking" the cursor in the commandline until it finds the next match.

@Asheq
Copy link
Author

Asheq commented Nov 11, 2023

The downstream issue in neovide: neovide/neovide#1665

@zeertzjq
Copy link
Member

zeertzjq commented Nov 11, 2023

This seems intentional. There is even an explicit cursor move to cmdline:

gotocmdline(false);

@Asheq
Copy link
Author

Asheq commented Nov 12, 2023

If there's no good reason for the explicit cursor move, I would favor removing it. It does cause an erratic/jittery user experience, especially with an animated cursor as shown in the screen capture above, and in the downstream issue in neovide.

I'm not familiar with C or the code-base at all, but I imagine that the reasoning for moving the cursor to the command line was to put it in a temporary "holding area" until the next match was found. A better UX would be to just leave the cursor exactly where it is. Then when it is finally moved to the next match, the transition/animation is natural.

@justinmk
Copy link
Member

justinmk commented Jun 21, 2024

This is a feature, it's how vim indicates "busy" state.

However, the code that @zeertzjq mentioned can be improved, it should call ui_busy_start / ui_busy_stop. Then UIs can choose how to signal "busy".

The call to gotocmdline is probably still needed, but signaling "busy" will allow UIs to opt-out of showing the cursor.

@justinmk justinmk added the complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md label Jun 21, 2024
@justinmk justinmk modified the milestones: unplanned, backlog Jun 21, 2024
@Asheq
Copy link
Author

Asheq commented Jun 22, 2024

The call to gotocmdline is probably still needed

Why is that?

but signaling "busy" will allow UIs to opt-out of showing the cursor.

It would be great it if a UI could opt to continue showing the cursor during "busy" but leave it where it is for the sake of natural-looking cursor animations.

@Shougo
Copy link
Contributor

Shougo commented Jun 22, 2024

Why is that?

This is to let the user know that processing is taking place.
The cursor being on the command line indicates that the user is not available to operate.
This is equivalent to the hourglass icon in Windows GUI.

@Shougo Shougo linked a pull request Jun 22, 2024 that will close this issue
@Shougo
Copy link
Contributor

Shougo commented Jun 22, 2024

@Asheq You can test #29446.

@Asheq
Copy link
Author

Asheq commented Jun 27, 2024

@Asheq You can test #29446.

Thanks. The cursor no longer appears to go the command line during search.

It does disappear and then reappear in the new location, though. This is fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior complexity:low Low-risk, self-contained. Do NOT ask "can I work on this", just read CONTRIBUTING.md display redraw, layout, presentation performance issues reporting performance problems
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants