-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Weird blue selection after closing neovim (WSL) #3848
Comments
I bet @j4james has an inkling as to what's happening here 😁 |
I was just looking at this, because I thought I knew what it was, but I'm not so sure now. 😄 I thought it might be related to #2540, but I can't reproduce this exact scenario. A couple of questions for @schffp:
|
PS: I've just cleared out my whole nvim config file. Same bug, but the "selection" is white now. |
@schffp Thanks for those details. I can reproduce it now. The green bars are a known issue (#32). And I think #293 and/or #2661 may have something to do with the exact colors you're seeing. But I need to do a bit more digging to find out what is going on with the nvim resizing side of things. That may be something new. |
Just a quick status update before I go to sleep. #2540 is partly to blame, and fixing that should address this issue too, but that's really just covering up a deeper problem. Namely that a resize operation fills the lower part of the buffer with the active attributes, which I'm pretty sure is wrong. And it's possible #399 may be a related issue - if not the same - although I haven't had a chance to look at that in much detail yet. |
@j4james thanks for digging into this 😄 we really appreciate it |
The short answer to this is you need to use the default attributes (i.e. The long answer is more complicated. Sometimes the initial buffer is initialized as legacy white on black, rather than the default colors, and in those circumstances it would be more correct for the resize to use those same colors. And in theory, it's possible that the forward buffer could be filled with a whole range of different colors, in which case the resize should really be trying to preserve those colors in whatever way makes the most sense for a reflow (at the very least that should be done for the visible viewport). And anything not covered by that reflow should probably use the same colors as the bottom right corner (of the buffer, not the viewport). 99% of the time, though, the default attributes are going to be the right choice, so that's at least a reasonable short-term improvement. |
Just a tidbit related to this. When I run neovim, neovim will change the cursor from WT-set "vintage" to neovim-set block cursor (filledRectangle?). When exiting neovim, cursor stays as block cursor instead of returning to vintage cursor. After having started and exited neovim to produce this "lingering" block cursor, the terminal starts doing weird things; the closest I could describe it as is that some escape sequences are lingering and not cleaned up properly. I don't know where the fault lies, but at least this neovim-setting seems to fix it for now, which tells neovim to not change the cursor shape at all: |
Another potential repro: When pwsh is out-of-date, it prints out a "hey you should get the new one" banner when it starts (the banner has a different background). If I double-click Terminal’s title bar to maximize it at juuuuust the right time while it is starting, I get some funky spillage of the background color: If I then “restore” the window, everything goes back to normal. And then if I maximize again, it doesn’t go back to the funky view—it still looks normal. |
Sorry but this issue still exists in the latest build, and this issue can be really annoying, it will be very grateful that it can be fixed in next release...... |
Sorry, but I don't have the time this month to loop back on #5792 and do the due diligence to make sure that's the right fix. Usually I'd trust @j4james for help with those sorts of things, he might be able to give me a sanity check. Maybe we could just toss that in (before the bug bash friday...? @DHowett) and see how it feels. Less risky now that we're in the 2.0 "break everything" phase rather than the high-bar-for-1.0-release phase. It's been just about a year since I authored that PR so I don't really have the context anymore, unfortunately. |
I'm still not in a position where I can do any real testing, but I believe PR #5792 is the right move. I was initially somewhat concerned (back in 2019) that the buffer should be initialized with white on black in some cases, but that was addressed in PR #6698, so all shells should be initializing with default attributes now. |
…5792) When we resize the text buffer, initialize the buffer with the _default_¹ attributes, not the _current_ ones. If we use the current attributes, then we can get into scenarios where something like `vim` is running, and left the attributes set to something other than the defaults, and when we resized the buffer, we'd fill it up with color, as opposed to whatever the default would be. This PR instead initializes the buffers with the default colors. It also makes sure to set the active attributes of the newly created buffers back to whatever the current attributes of the old buffer were. [1]: For the Terminal, the default attributes are "default on default". For conhost, the default attributes are whatever the result of `Settings::GetDefaultAttributes` is, which could be any combo of the legacy indices and the default color. ## PR Checklist * [x] Closes #3848 * [x] I work here * [x] Tests added/passed * [n/a] Requires documentation to be updated ## Validation Steps Performed * ran tests
Sorry for the late reply, it's okay, I commented on this issue just for your awareness since this issue could really impact us as users. |
🎉This issue was addressed in #5792, which has now been successfully released as Handy links: |
Environment
Steps to reproduce
Actual behavior
A weird blue "selection" appears
clear
gets rid of itThe text was updated successfully, but these errors were encountered: