0

Normally, resizing CMD works normally for me, where the directory prompt (is that what it's called?) stays on the left side of the screen no matter the size of the terminal. However, if I open vim (or man via my msys2), and close it again, resizing the window acts as every line includes spaces at the end, up to the length of the buffer. Resizing in this state wraps everything as if it was a single piece of text, so I end up with a very messy terminal. This still happens if I run bash within CMD, or even an emulator like Cmder/ConEmu. Here's some pictures of what I'm talking about.

Here, I just make some sample output. The Terminal width is 105. Command Prompt with some sample output, before resizing.

Then, I resize the terminal down. To be specific, the width is now 77. Everything works as expected. The result of resizing from big to small before running vim.

Then, I return the terminal to the original size, open and close vim, then resize back down to the smaller size. Everything is now messed up. I can redraw the screen to fix it temporarily, but all future resizes will wrap text incorrectly. This requires closing the terminal and opening it again to fix. Resizing from big to small after running vim.

What is the root cause of this? I don't think it has to do with line endings, because changing the fileformat setting to ff=dos doesn't help. It's as if each line is treated as having spaces at the end of it, instead of a newline character.

  • 1
    This maybe a terminal emulator-vim mismatch; I suspect one of the control codes used to affect the screen is wrong – D. Ben Knoble Sep 21 '19 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.