Windows cmd prompt and powershell have scrolling problems with vi editor when connecting by ssh to Linux system

I am trying to connect from my Windows laptop to a Linux system via ssh in the command prompt. (Tried powershell too.) If I try to use the vi editor, the screen cannot scroll properly. Many lines of text get repeated and the file display becomes unreadable. Is there a way to make scrolling behave with ssh, vi, and the MS command prompt (or powershell)?


cmd and powershell are shells and have nothing to do with the scrolling of vi, which is related to the terminal. Just like in Unix where shells like bash, fish or zsh must be run inside a terminal like xterm or gnome-terminal, both of those Windows shells must be connected to a terminal to work, and the default terminal in older Windows is conhost.exe. That's why you see the same similar interface when opening both cmd and powershell

Conhost.exe has very limited feature and has just got some POSIX support like ANSI sequences not so long ago, and it doesn't support scrolling the ANSI way very good. The way to solve this is to use a better terminal, like Windows Terminal. If you have other terminals like ConEmu, Hyper or the one bash uses when installing git then you can also use them