wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
14.82k stars 674 forks source link

Scroll history is missing lines #1923

Open chtenb opened 2 years ago

chtenb commented 2 years ago

What Operating System(s) are you seeing this problem on?

Windows

WezTerm version

wezterm 20220421-183827-26500c67

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

Let's print a list of numbers

image

Then scrolling up

image

there appear to be missing lines right at the edge of the screen

To Reproduce

No response

Configuration

no config

Expected Behavior

No response

Logs

15:15:09.359 INFO wezterm_client::discovery::windows > published gui path as gui-sock-23932 15:15:09.419 WARN window::os::windows::window > EGL init failed Config says to avoid EGL, fall back to WGL 15:15:09.687 INFO wezterm_gui::termwindow > OpenGL initialized! Quadro M2200/PCIe/SSE2 4.5.0 NVIDIA 472.91 is_context_loss_possible=true wezterm version: 20220421-183827-26500c67

Anything else?

No response

chtenb commented 1 year ago

Is there any chance we'll get a fix for this in the not-too-distant future? It's a pretty crucial bug as I sometimes miss lines in command output, which obviously is something that induces mistakes and slowdowns.

If there is anything I can do to help, provide more info etc, I'd be happy to do it!

wez commented 1 year ago

I think it may be due to:

as this issue doesn't occur on other platforms.

Are you able to disable coloring of the output to see if the issue goes away? If so, then it adds weight to that theory.

wez commented 1 year ago

Other things to look at to try to isolate this:

It may also be useful to capture a session recording:

*** Finished recording to /var/tmp/wezterm-recording-sF6B3u.cast.txt

The file is an asciicast (compatible with https://asciinema.org/) and can also be replayed using wezterm replay.

The terminal recording allows me to replicate what is being sent to the terminal without requiring me to install the same applications as you and replicate your configuration for everything.

chtenb commented 1 year ago

wezterm-recording-vUPbou.cast.txt

Here is a cast of me reproducing the issue.

I noticed however when replaying it with wezterm replay that I couldn't see the scroll actions being performed. But the issue is ONLY ever visible when I scroll up and notice that lines are missing there. Even though I have seen the missing lines pass by when they were still visible in the default viewport.

chtenb commented 1 year ago

Okay, I was sure I tried reproducing this on other terminals without success before I created the issue here. But I just reproduced it on VSCode's integrated terminal using the same method. This adds more weight to your theory of it being an upstream issue.

What I don't understand though, is that those lines only disappear once they fall off the default viewport and you scroll up. I have limited knowledge about how terminal emulators work but I always thought the history/scroll feature was a emulator-specific implementation.

chtenb commented 1 year ago

Simplifying your prompt printing setup.

Good call. I removed my starship configuration and after that I couldn't reproduce the issue anymore. Neither in VSCode and wezterm. I wonder what it is about starship that throws conpty off.

chtenb commented 1 year ago

This looks like the same issue but it got closed: https://github.com/starship/starship/issues/4635

chtenb commented 1 year ago

I think it may be due to: https://github.com/microsoft/terminal/issues/8698 as this issue doesn't occur on other platforms.

Is conpty also used when using WSL? I can reproduce the issue both on native windows and WSL.

chtenb commented 1 year ago

So there is a workaround posted in the other thread which works for me. Feel free to close this issue if you want. Other people with the same issue can follow the instructions in the linked thread.

quantonganh commented 7 months ago

To reproduce:

$ for i in (seq 1 30); echo $i $i; end

Screen_Shot_2023-11-17_at_10_07_39

History is not missing if we do not clear the screen.

quantonganh commented 7 months ago

To anyone who want to keep scrollback buffer after clear: https://github.com/fish-shell/fish-shell/issues/2855#issuecomment-201377349