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

fix: cmdheight increase overwrites messages that need hit-enter #13432

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nwounkn
Copy link
Contributor

@nwounkn nwounkn commented Oct 27, 2023

set laststatus=2 cmdheight=1
echo 'foo'
echo 'bar'
set cmdheight=2

Shows only hit-enter prompt.

@chrisbra
Copy link
Member

what exact problem does this solve? I cannot seem to see a difference with or without that patch.

@nwounkn
Copy link
Contributor Author

nwounkn commented Oct 28, 2023

If you type :echo "one\ntwo\nthree\nfour" | set ch=2 in an already running vim with cmdheight=1, without the patch the lines 'three' and 'four' aren't shown, with the patch the message is shown completely. This is to fix neovim's issue neovim/neovim#22646 , but since vim is somewhat affected too, I decided to make the PR here.
Sorry for bothering, if it's too insignificant to fix.

@chrisbra
Copy link
Member

hm, I not sure this is correct, I saw some rendering artifacts when using Vim with this patch and echoing something. Let me use this for a while and see if I can reproduce it or if this works correct.

@ychin
Copy link
Contributor

ychin commented Nov 3, 2023

I have found some other issues with this type of usages (with or without this patch). For example, try running (with a clean config or make sure cmdheight=1) this: :version | set ch=2.

What you see is a normal version output, and after hitting Enter it goes back to looking like cmdheight is 1, but it's actually set to 2. There are all kinds of weird things you can do after that, such as being able to set cmdheight to 0, which is disallowed in Vim, and in general there seems to be a permanent off-by-one-error that is stuck in the cmdheight calculation unless you manually drag the status bar using a mouse which would force the calculation to be done correctly.

Seems like in general the command_height function doesn't really work well when called when a message is shown with a pending hit-enter. I think this patch will fix some of the issues but it may leave others unfixed. I wonder if it's better to just delay calling the entire command_height until hit-enter to prevent any logic inconsistencies because otherwise I find it pretty hard to reason about each state change piecemeal. That said, maybe it's not a bad idea to find out why the remaining buggy behavior happens (in the example I gave above).

FWIW, what kind of situation does this come up in @nwounkn ? I'm curious why we would see an echo message and a cmdheight set on the same line. The current behavior is still a bug, of course, but I just don't see this pattern often.

@chrisbra
Copy link
Member

chrisbra commented Nov 4, 2023

yes, I assume this is some kind of a very specific problem. But it would be good if we could also fix the remaining problems if possible

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.

None yet

3 participants