microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.58k stars 8.31k forks source link

scrolling in emacs scrolls the screen, not emacs buffer #9545

Closed tsengalb99 closed 3 years ago

tsengalb99 commented 3 years ago

In linux terminals (gnome terminal, konsole, termux, etc.), scrolling in an emacs window moves the cursor, not the actual output. Currently (version 1.6.10571.0), scroll behavior in Windows Terminal appears to be captured by the terminal and not passed on to the application, as it should. I am almost certain this is an issue with Terminal since MinTTY handles scrolling fine with GitBash, but Terminal does not.

Will this be fixed (when I last used windows terminal half a year ago, I noticed this problem), and if so, when?

skyline75489 commented 3 years ago

what version of emacs are you using? Are you using WSL? Are you using SSH?

skyline75489 commented 3 years ago

It's a bit complicated, but although MinTTY (GitBash) looks like Terminal, the underlying tech stacks are very different.

tsengalb99 commented 3 years ago

ssh to an ubuntu machine, emacs 25.2.2, but the version of emacs does not seem to make a difference (tried this on multiple machines)

skyline75489 commented 3 years ago

OK that makes sense. I know it sounds easy, there's actually a lot of things that need to be fixed, OpenSSH on Windows being an example. See https://github.com/microsoft/terminal/issues/8528#issuecomment-741544578 .

You can try the newer version of OpenSSH in Win32-OpenSSH repo.

tsengalb99 commented 3 years ago

I installed the newer version of openssh, but the cursor still doesn't scroll. The screen stops scrolling, which is nice, but the cursor is still stuck.

tsengalb99 commented 3 years ago

Also, it doesnt completely make sense to me why openssh on windows would be the issue. Git Bash ships with its own version of ssh (presumably also openssh), which works fine in mintty but not windows terminal. Doesn't this imply terminal's handling of scrolling and ssh is wonky? Mintty seems to handle it just fine.

skyline75489 commented 3 years ago

You see, the MinTTY (together with its openssh) runs inside MSYS, which is kind of a minimal Linux environment on Windows. But the Win32-OpenSSH you're using is a native version of OpenSSH running on Windows. These two versions of OpenSSH are mostly the same, but remarkably different about how they interact with terminals. That's why you may find the SSH shipped with Git Bash is not working inside Windows Terminal. I don't want to bore you with all the technical details. The conclusion is that, the entire terminal ecosystem on Windows is not (yet) as complete as Linux. MSYS was the "old" solution that simulate what Linux does on Windows. Windows Terminal is the new kid in town.

tsengalb99 commented 3 years ago

Interesting. How would I go about getting functioning scroll behavior then? It appears that the latest openssh still doesn't handle scrolling correctly.

I would use mintty except it doesn't offer tabs, and the other features of windows terminal are useful too.

skyline75489 commented 3 years ago

I wish I could help but I'm a Vim user. And I don't know the SSH side of the story that well. Please be patient and wait for the response from the core developers of this project.

I know it sounds a simple issue that should be solved a long time ago. But trust me, most what you see is just the tip of an iceberg. Take a look at the 1200+ issues in this repo and you'll know what I mean. As a terminal project, Windows Terminal is actually very young (six years old roughly?), comparing to GNOME terminals and alike, which is like 20+ years old. And Windows is fundamentally different than *nix in so many ways. So please keep calm & have a little patience 😃

zadjii-msft commented 3 years ago

This sounds a lot like #9534. I think at the end of the day, this is caused by the Terminal not properly supporting the alternate screen buffer.

/dup #381 /dup #3321

ghost commented 3 years ago

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!