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

Neovim Cursor Flickers from Block to Bar running in MS Terminal under Tmux #5180

Closed
mebaran opened this issue Mar 30, 2020 · 7 comments · Fixed by #5181
Closed

Neovim Cursor Flickers from Block to Bar running in MS Terminal under Tmux #5180

mebaran opened this issue Mar 30, 2020 · 7 comments · Fixed by #5181
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conpty For console issues specifically related to conpty Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@mebaran
Copy link

mebaran commented Mar 30, 2020

Environment

Windows build number: 10.0.19041.172
Windows Terminal version (if applicable):  0.10.781.0

Other software:
Debian WSL2 running tmux

Steps to reproduce

  1. Start tmux
  2. Start neovim (nvim -u NORC)
  3. Enter insert mode
  4. Watch cursor flicker between block and thin line

Expected behavior

Cursor should remain a line and not flicker. (this is the behavior in WSLtty)

Actual behavior

Cursor flickers between block and line.

@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Mar 30, 2020
@DHowett-MSFT
Copy link
Contributor

This doesn't seem to reproduce with stock configs of tmux and neovim on Debian:

image

no cursor flickering here.

@DHowett-MSFT DHowett-MSFT added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Mar 30, 2020
@mebaran
Copy link
Author

mebaran commented Mar 31, 2020

Thank you for investigating this. To reproduce please run the following before to recreate the cursor flicker:

tmux set -g status-right %H:%M:%S
tmux set -g status-interval 1

That seems to cause the cursor flicker issues. The flicker seems to occur in tandem with tmux rewriting the status bar (if you set the interval to 5, the cursor will flicker every 5s). I can confirm the same issue doesn't happen in a mintty based terminal.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Mar 31, 2020
@DHowett-MSFT
Copy link
Contributor

You know what, this looks like it's probably because we typoed the escape sequence that turns off the cursor. tmux and vim "fight" over the cursor, but tmux turns it off before it writes out the status line.

This is incidentally fixed by #5181 (ref #3093)

@ghost ghost added the In-PR This issue has a related PR label Mar 31, 2020
@DHowett-MSFT DHowett-MSFT added Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conpty For console issues specifically related to conpty and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Mar 31, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Mar 31, 2020
@DHowett-MSFT DHowett-MSFT removed the Needs-Attention The core contributors need to come back around and look at this ASAP. label Mar 31, 2020
@mebaran
Copy link
Author

mebaran commented Mar 31, 2020

That sounds like exactly what is happening. Let me know if I can help test a beta build or when this makes it to a release.

@ghost ghost closed this as completed in #5181 Apr 9, 2020
ghost pushed a commit that referenced this issue Apr 9, 2020
Now that the Terminal is doing a better job of actually marking which
lines were and were not wrapped, we're not always copying lines as
"wrapped" when they should be. We're more correctly marking lines as not
wrapped, when previously we'd leave them marked wrapped.

The real problem is here in the `ScrollFrame` method - we'd manually
newline the cursor to make the terminal's viewport shift down to a new
line. If we had to scroll the viewport for a _wrapped_ line, this would
cause the Terminal to mark that line as broken, because conpty would
emit an extra `\n` that didn't actually exist.

This more correctly implements `ScrollFrame`. Now, well move where we
"thought" the cursor was, so when we get to the next `PaintBufferLine`,
if the cursor needs to newline for the next line, it'll newline, but if
we're in the middle of a wrapped line, we'll just keep printing the
wrapped line.

A couple follow up bugs were found to be caused by the same bad logic.
See #5039 and #5161 for more details on the investigations there.

## References

* #4741 RwR, which probably made this worse
* #5122, which I branched off of 
* #1245, #357 - a pair of other conpty wrapped lines bugs
* #5228 - A followup issue for this PR

## PR Checklist
* [x] Closes #5113
* [x] Closes #5180 (by fixing DECRST 25)
* [x] Closes #5039
* [x] Closes #5161 (by ensuring we only `removeSpaces` on the actual
  bottom line)
* [x] I work here
* [x] Tests added/passed
* [n/a] Requires documentation to be updated

## Validation Steps Performed

* Checked the cases from #1245, #357 to validate that they still work
* Added more and more tests for these scenarios, and then I added MORE
  tests
* The entire team played with this in selfhost builds
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Apr 9, 2020
@ghost
Copy link

ghost commented Apr 22, 2020

🎉This issue was addressed in #5181, which has now been successfully released as Windows Terminal Preview v0.11.1121.0.:tada:

Handy links:

@mebaran
Copy link
Author

mebaran commented May 9, 2020

This bug does not seem fixed in the latest release. Possible to reopen?

From about this is my version:
Windows Terminal
Version: 0.11.1121.0

@mariuskimmina
Copy link

Doesn't look fixed to me either, when I am in Insert mode in Neovim (with tmux) the cursor is flickering between line mode and block mode.
This does not happen if I use alacritty instead of the Windows Terminal.

Version; 1.11.2421.0

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-VT Virtual Terminal sequence support Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Conpty For console issues specifically related to conpty Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants