Skip to content

fix(cmdline): check cursor position to avoid hang on exit#936

Closed
iguanacucumber wants to merge 1 commit into
folke:mainfrom
iguanacucumber:main
Closed

fix(cmdline): check cursor position to avoid hang on exit#936
iguanacucumber wants to merge 1 commit into
folke:mainfrom
iguanacucumber:main

Conversation

@iguanacucumber
Copy link
Copy Markdown

Description

since this commit, sometime when you exit neovim, it hangs for a second with a visual glitch then it exits:
video example

Just before neovim exits you get this error message:

Error executing vim.schedule lua callback: ...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: Cursor position outside buffer
stack traceback:
	[C]: in function 'nvim_win_set_cursor'
	...ocal/share/nvim/lazy/noice.nvim/lua/noice/ui/cmdline.lua:237: in function 'fix_cursor'
	...ocal/share/nvim/lazy/noice.nvim/lua/noice/util/hacks.lua:43: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>

So i added some checks to the cursor variable in the fix_cursor() function inside lua/noice/ui/cmdline.lua to check if the cursor was out of bounds and this seems to fix the issue

Related Issue(s)

@dvejmz
Copy link
Copy Markdown

dvejmz commented Aug 28, 2024

I'm experiencing this issue too. My noice.nvim is on commit 448bb9c524a7601035449210838e374a30153172 and I'm using Neovim 0.10.1 on Fedora Linux 40.

@iguanacucumber
Copy link
Copy Markdown
Author

iguanacucumber commented Sep 9, 2024

I'm experiencing this issue too.

Does this happen with my patch or with the vanilla plugin ?

@folke folke closed this in 8c6a024 Sep 18, 2024
folke pushed a commit that referenced this pull request 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Noice is causing NeoVim on macOS to hang on exit

2 participants