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

bug: Cursor jumps in cmdline - 4.5.0 (MacOS + Wezterm) #950

Closed
4 tasks done
gotgenes opened this issue Sep 18, 2024 · 19 comments · Fixed by #951
Closed
4 tasks done

bug: Cursor jumps in cmdline - 4.5.0 (MacOS + Wezterm) #950

gotgenes opened this issue Sep 18, 2024 · 19 comments · Fixed by #951
Labels
bug Something isn't working

Comments

@gotgenes
Copy link

gotgenes commented Sep 18, 2024

Did you check docs and existing issues?

  • I have read all the noice.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of noice.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.10.1 Release

Operating system/version

MacOS 14.6.1

Describe the bug

Opening a new issue per this comment in #923.

Steps To Reproduce

  1. Install Noice with minimal repro setup shown below.
  2. Open Wezterm
  3. Start Neovim
  4. Open the command :
  5. Observe the cursor flickering between the command prompt and another part of the Neovim UI.

Expected Behavior

The cursor stays rendered in the command prompt, and does not flicker around.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/noice.nvim", opts = {} },
    -- add any other plugins here
  },
})
@gotgenes gotgenes added the bug Something isn't working label Sep 18, 2024
@gotgenes gotgenes changed the title bug: Cursor jumps in cmdline - 4.5.0 (MacOS + Wezterm] bug: Cursor jumps in cmdline - 4.5.0 (MacOS + Wezterm) Sep 18, 2024
@folke
Copy link
Owner

folke commented Sep 18, 2024

Install Noice with LazyVim

I need a proper repro. Not a LAzyVim install.

Does the issue trigger with the provided repro?

@folke
Copy link
Owner

folke commented Sep 18, 2024

And like I said, please use a recent nightly to reproduce.

@JustBarnt
Copy link

JustBarnt commented Sep 18, 2024

Here is a repo just using minimal init.lua to reproduce

I am using Windows 11

Can reproduce with Wezterm and Windows 11

Repo: https://github.com/JustBarnt/nvim-noice-min

: nvim -v
NVIM v0.11.0-dev-783+g0ade8fed1
Build type: RelWithDebInfo
LuaJIT 2.1.1724512491
Run "nvim -V1 -v" for more info

Edit: I also tested this in Alacritty as well which the issue also exists there as well.

@dpetka2001
Copy link

@JustBarnt I tried your minimal repo but could not reproduce. I'm using same version of Neovim like you on Linux Mint 21.3 and latest Kitty terminal. Here's a screencast showing the process

Screencast_2024-09-18-19-12-50.webm

@JustBarnt
Copy link

JustBarnt commented Sep 18, 2024

@dpetka2001 Correct this appears to be an issue that seems limited to Mac OS and Windows for some reason.

I can reproduce the issue within Wezterm and Windows Terminal

I updated my original comment to clarify

@gotgenes
Copy link
Author

@folke Thanks for your reply.

Install Noice with LazyVim

I need a proper repro. Not a LAzyVim install.

Does the issue trigger with the provided repro?

Yes, it does. My apologies. In my haste, I forgot to update the instructions to say use the minimal repro. I have edited to correct this.

And like I said, please use a recent nightly to reproduce.

I also reproduced on nightly from Neovim's releases:

NVIM v0.11.0-dev-783+g0ade8fed1
Build type: RelWithDebInfo
LuaJIT 2.1.1724512491
Run "nvim -V1 -v" for more info

@gotgenes
Copy link
Author

I'm also confirming that pinning noice to v4.4.7 makes the flickering behavior go away—in both stable and nightly Neovim:

vim.env.LAZY_STDPATH = '.repro'
load(vim.fn.system('curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua'))()

require('lazy.minit').repro({
  spec = {
    { 'folke/noice.nvim', tag = 'v4.4.7', opts = {} },
    -- add any other plugins here
  },
})

@dpetka2001
Copy link

Yes, I just tried with latest neovim-nightly and wezterm-nightly installed via scoop on Windows 10 and I can confirm that the issue exists on Windows. Really strange.

@folke
Copy link
Owner

folke commented Sep 18, 2024

I'm also on linux.

Will look into it tomorrow to see what's happening on Windows.

I'm not going to revert to v4.4.7. The way that used to work was one big hack by hooking into redraw calls.
The new way is the way it should work.

@JustBarnt
Copy link

@folke I actually think I just figured out the cause! Currently testing on Windows with all mentioned terminals! I just need someone to be able to test the PR within linux (to confirm there are no regressions) and on Mac to confirm it fixed it there as well

@folke folke linked a pull request Sep 18, 2024 that will close this issue
@dpetka2001
Copy link

I tested the linked PR locally and from my short testing I don't see any regression on Linux. Hope I didn't miss something. Folke obviously will have a better opinion on this.

@folke
Copy link
Owner

folke commented Sep 18, 2024

Yeah indeed, that cursor = true shouldn't be there.

But there's some thing I want to check first.

@JustBarnt
Copy link

Yeah setting cursor to false works as well.

@folke
Copy link
Owner

folke commented Sep 18, 2024

@JustBarnt what was the thing that you found to fix it?

@JustBarnt
Copy link

JustBarnt commented Sep 18, 2024

@folke I found that adding win = Cmdline.win() also fixes the issue.

Not sure what the correct fix per say is.
Although it sounds like cursor = false is the correct fix

if not Util.is_search() then
  if vim.api.nvim__redraw then
      vim.api.nvim__redraw({ flush = true, cursor = true, win = Cmdline.win() })
    else
      vim.cmd.redraw()
    end
  end

@folke
Copy link
Owner

folke commented Sep 18, 2024

@JustBarnt that's also a good idea, but I think it's not really needed.

I just pushed some changes, so would be great if everyone could check if the problem is now gone.

@JustBarnt
Copy link

JustBarnt commented Sep 18, 2024

@folke Yeah after I read you comment that cursor = true wasn't supposed to be there I had assumed what I had found isn't necessarily the right fix.

I can confirm on Windows with Wezterm, Windows Terminal, and Alacritty the issue is fixed via commit 3373ab5

@folke
Copy link
Owner

folke commented Sep 18, 2024

Great :) The issue was due to a bad copy-paste I did from the cmdline code.

Glad it's fixed!

But still weird, that the problem didn't show on Linux. The code was indeed just wrong and I would have expected the cursor to be flickering between the real position and the cmdline. But for some reason that didn't happen on Linux. Probably some debounce somewhere specifc to Linux.

folke pushed a commit that referenced this issue Sep 18, 2024
🤖 I have created a release *beep* *boop*
---


## [4.5.1](v4.5.0...v4.5.1)
(2024-09-18)


### Bug Fixes

* dont redraw when exiting. Fixes
[#936](#936). Fixes
[#921](#921)
([8c6a024](8c6a024))
* **hacks:** dont close timer multiple times during exit
([86a4891](86a4891))
* **hacks:** only redraw cursor when cmdline is active. Fixes
[#950](#950). Fixes
[#937](#937). Fixes
[#923](#923)
([3373ab5](3373ab5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@gotgenes
Copy link
Author

Fix confirmed on my system, too. Thanks, @folke!

gotgenes pushed a commit to gotgenes/dotfiles that referenced this issue Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants