Skip to content

Wrong cursor position after formatting with long 'formatprg'#18906

Closed
zeertzjq wants to merge 1 commit intovim:masterfrom
zeertzjq:wait-return-stuff
Closed

Wrong cursor position after formatting with long 'formatprg'#18906
zeertzjq wants to merge 1 commit intovim:masterfrom
zeertzjq:wait-return-stuff

Conversation

@zeertzjq
Copy link
Member

@zeertzjq zeertzjq commented Dec 11, 2025

Problem: Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.

Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.

fixes: #18905

@zeertzjq zeertzjq force-pushed the wait-return-stuff branch 2 times, most recently from 04ed3aa to 73b1e84 Compare December 11, 2025 05:33
Problem:  Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.

Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.

fixes: vim#18905
@zeertzjq zeertzjq marked this pull request as ready for review December 11, 2025 05:50
@chrisbra
Copy link
Member

thanks

@chrisbra chrisbra closed this in 50325c3 Dec 11, 2025
@zeertzjq zeertzjq deleted the wait-return-stuff branch December 11, 2025 23:30
zeertzjq added a commit to zeertzjq/neovim that referenced this pull request Dec 11, 2025
…'formatprg'

Problem:  Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.

Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.

fixes:  vim/vim#18905
closes: vim/vim#18906

vim/vim@50325c3
zeertzjq added a commit to neovim/neovim that referenced this pull request Dec 12, 2025
…'formatprg' (#36918)

Problem:  Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.

Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.

fixes:  vim/vim#18905
closes: vim/vim#18906

vim/vim@50325c3
github-actions bot pushed a commit to neovim/neovim that referenced this pull request Dec 12, 2025
…'formatprg' (#36918)

Problem:  Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.

Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.

fixes:  vim/vim#18905
closes: vim/vim#18906

vim/vim@50325c3
(cherry picked from commit 18642a6)
github-actions bot pushed a commit to neovim/neovim that referenced this pull request Dec 12, 2025
…'formatprg' (#36918)

Problem:  Wrong cursor position after formatting with long 'formatprg'.
Solution: Don't show hit-enter prompt when there are stuffed characters.

Previously a stuffed character at the hit-enter prompt will dismiss the
prompt immediately and be put in the typeahead buffer, which leads to
incorrect behavior as the typeahead buffer is processed after the stuff
buffers. Using vungetc() when KeyStuffed is TRUE can fix this problem,
but since the hit-enter prompt isn't visible anyway (and is likely not
desired here), just skip the prompt instead, which also avoids a wait
when using "wait" instead of "hit-enter" in 'messagesopt'.

fixes:  vim/vim#18905
closes: vim/vim#18906

vim/vim@50325c3
(cherry picked from commit 18642a6)
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.

Cursor moves unexpectedly after formatprg

2 participants