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

Text Doesn't Reflow Properly on Window Resize after Vim Opened and Closed #7466

Closed
Jacob-Bishop opened this issue Aug 30, 2020 · 16 comments
Closed
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@Jacob-Bishop
Copy link

Environment

Windows build number: 10.0.18362.0
Windows Terminal version: 1.2.2381.0
Vim: 8.1

Steps to reproduce

  1. Open Powershell in a Windows Terminal tab.
  2. Launch Vim.
  3. Close Vim.
  4. Expand the terminal window on the right side (i.e., use the mouse to resize the window).

Expected behavior

The beginning of each "PS" prompt should be anchored to the left-hand side of the window.

Actual behavior

The second "PS" prompt wraps backward onto the first line
image

Notes

This might be a duplicate with @waf's report in #7232, although this is about resizing the terminal after vim has exited and his report was about resizing the terminal while vim was open.

@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 Aug 30, 2020
@zadjii-msft
Copy link
Member

Is this vim.exe, or a vim from a wsl distro?

@zadjii-msft zadjii-msft added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 30, 2020
@Jacob-Bishop
Copy link
Author

Sorry, vim.exe.

@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 Aug 30, 2020
@elhannah
Copy link

I have similar and I think "same" problem. When I open an Ubuntu tab in Windows Terminal, unless the terminal is exactly 50 lines and 140 columns, vim draws screen incorrectly (it's seemingly clear that vim thinks the dimensions are as above, 50x140).

I can provide some debugging information that can help re-create. If you use the "tput lines" and "tput cols" command, the window should print correspondingly the number of lines and columns:

elhannah@office-win10:/mnt/c/Users/elhan$ tput lines
50
elhannah@office-win10:/mnt/c/Users/elhan$ tput cols
140

After resizing with mouse, the window correctly reports the new sizes:

elhannah@office-win10:/mnt/c/Users/elhan$ tput lines
38
elhannah@office-win10:/mnt/c/Users/elhan$ tput cols
102

Now, if you execute "vim", the screen looks something like:

image

and after exiting (since you can't really effectively edit :-(...

lines and cols are back to the default, and no longer represent the actual lines and cols of the window.

elhannah@office-win10:/mnt/c/Users/elhan$ tput lines
50
elhannah@office-win10:/mnt/c/Users/elhan$ tput cols
140

However, what's odd, is in some cases I have been able to initiate an Ubuntu tab and after using "tput lines" and "tput cols", the screen behavior is fine and remains consistent even with window resizing. It seems once a tab is working, it continues to work fine. This so far is random to me. I've not been able to predict, nor coax a tab into good behavior, nor stop one that is working from going back to the incorrect behavior.

@j4james
Copy link
Collaborator

j4james commented Sep 2, 2020

@elhannah Is it possible you've got something like set lines=50 columns=140 in your .vimrc file? Those are options that vim uses to set the default window size, but that resizing functionality is not yet supported by Windows Terminal (see issue #5094). The problem is that conhost does actually support resizing, so the conhost backend and the Terminal frontend get out of sync, and that results in everything rendering in the wrong place.

@elhannah
Copy link

elhannah commented Sep 3, 2020 via email

@elhannah

This comment has been minimized.

@j4james
Copy link
Collaborator

j4james commented Sep 3, 2020

The REPLACE mode problem is probably issue #1637. One theory is that it's got something to do with vim sending a cursor position requestion, for which the response is an escape sequence ending with R. If something goes wrong with the parsing of that response it may be misinterpreted as an R keypress.

@Jacob-Bishop
Copy link
Author

@elhannah I think that might be a different problem -- I'm not seeing any problem with vim opening in replace mode, and resizing while Vim's open works fine. Maybe because I'm launching vim.exe from powershell rather than vim in an ubuntu terminal?

@elhannah
Copy link

elhannah commented Sep 4, 2020 via email

@doesitblend

This comment has been minimized.

@DHowett

This comment has been minimized.

@zadjii-msft
Copy link
Member

Hey sorry for letting this go untriaged for so long - @Jacob-Bishop could you share your powershell profile? Have you done anything to your .vimrc that might change lines or columns? I can't get this to repro locally with a vim.exe v8.2 (but I'd doubt that this was changed in between those two versions)

@zadjii-msft zadjii-msft added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Oct 1, 2020
@elhannah
Copy link

elhannah commented Oct 1, 2020 via email

@Jacob-Bishop
Copy link
Author

@zadjii-msft, thanks for looking into this:

  1. I just successfully reproduced the issue in a Command Prompt tab, so it doesn't seem to be a powershell-specific issue. I also haven't created a powershell config file. That said, I am running an old version of powershell -- 5.1.18362.752. I don't think that should matter?

  2. I just updated Vim to 8.2 (the gvim_8.2.0012_x86_signed.exe installer recommended on vim.org), and I'm still seeing the issue. I can reproduce the issue with vim --clean, so it shouldn't be related to my Vim config either.

Current Windows Terminal version is 1.3.2651.0, the latest version on the Microsoft Store.

Let me know if there is other information that would be useful.

One additional note that I don't think I mentioned originally, which may be helpful in your attempts to reproduce- lines created after exiting Vim are correctly anchored to the left side of the terminal, but lines created before opening vim are not.
image

@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 Oct 3, 2020
@DHowett
Copy link
Member

DHowett commented Oct 23, 2020

So, I think that this is another instance of #3088. It's not titled correctly, but there's something that vim does when launches/exits that causes it to print out every character that was on the screen. After that happens, lines in the buffer are incorrectly marked as wrappable.

/dup #3088

@ghost
Copy link

ghost commented Oct 23, 2020

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Oct 23, 2020
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed 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 Needs-Attention The core contributors need to come back around and look at this ASAP. labels Oct 23, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

6 participants