nushell / nushell

A new type of shell
https://www.nushell.sh/
MIT License
31.7k stars 1.63k forks source link

Output is sometimes truncated when scrolling/resizing the terminal window #9164

Open MariaSolOs opened 1 year ago

MariaSolOs commented 1 year ago

Describe the bug

Not sure if this is editor specific (I've seen it happen in VS Code), but sometimes nushell will truncate printed output when resizing or scrolling the terminal pane.

How to reproduce

  1. Write the following Rust code:
    
    #[derive(Debug, Default)]
    struct Foo {
    foo: Bar,
    }

[derive(Debug, Default)]

struct Bar { bar: (Baz, Baz, Vec), }

[derive(Debug, Default)]

struct Baz { baz: u32, }

fn main() { let f = vec![ Foo::default(), Foo::default(), Foo::default(), Foo::default(), ]; println!("{:#?}", f); }


(I know that the code looks a bit odd, but I've seen the issue constantly happen with nested types like this).

2. Run `cargo run` from `nushell`. 

3. Look at the printed output and notice how some parts of the code are omitted.

### Expected behavior

I would like for the output to be printed in its entirety, without alterations when scrolling/resizing the terminal.

### Screenshots

Here's a recording:

https://github.com/nushell/nushell/assets/62502207/5f389228-060f-42a8-b8db-ffdad26f3a28

### Configuration

N/A

### Additional context

_No response_
fdncred commented 1 year ago

Does this happen in other terminals or just vscode's? I thought I remembered a bug in vscode's terminal that caused this, but maybe I'm misremembering.

MariaSolOs commented 1 year ago

Does this happen in other terminals or just vscode's? I thought I remembered a bug in vscode's terminal that caused this, but maybe I'm misremembering.

@fdncred I just tried it out in iTerm and I don't seem able to reproduce it (but I haven't tested it carefully). I don't think it's an editor bug entirely though because other shells don't have the same issue in VS Code, so it must be a "shared" bug between VS Code and nu.

sophiajt commented 1 year ago

I wonder if this is related to the terminal integration markers we output? @fdncred do you happen to know if there's a way to turn them off as a test?

floupette commented 1 year ago

I've been having a similar issue using nushell with Alacritty. Sometimes lines are not being printed at all to stdout. When I run apt upgrade, for instance, at some point everything will flash up on a single line, but none of it is displayed anymore :

Preparing to unpack .../firefox_113.0.1~1684251926~22.04~1bf5c7a_amd64.deb ...
Unpacking firefox (113.0.1~1684251926~22.04~1bf5c7a) over (113.0~1683649746~22.04~2ec5222) ...
Preparing to unpack .../libwebpmux3_1.2.2-2ubuntu0.22.04.1_amd64.deb ...
Unpacking libwebpmux3:amd64 (1.2.2-2ubuntu0.22.04.1) over (1.2.2-2) ...
Preparing to unpack .../openjdk-11-jre-headless_11.0.19+7~us1-0ubuntu1~22.04.1_amd64.deb ...
~>

Sometimes when I scrollup I notice part of what was previously there, if it was ever printed, has "disappeared", much like the two "}," missing in the video above.

fdncred commented 1 year ago

I wonder if this is related to the terminal integration markers we output? @fdncred do you happen to know if there's a way to turn them off as a test?

Yes, you can turn off OSC 133 with shell_integration: false in the config file. The downside to this is you won't be able to jump from prompt to prompt with one keyboard shortcut nor will you see the prompt indicators that show up as little dots on the right side of the prompt. I also think it disables the red dot/blue dot to the left of the prompt when there is an error/success.

Also, tab titles (OSC 7) are turned off when shell_integration is false too. Another part of OSC 7 is PWD communication so when you start a new tab the shell starts in your current folder.

You can also turn off clickable_links (OSC 8) to see if that makes any difference.

fdncred commented 1 year ago

Similar issue https://github.com/nushell/nushell/issues/9166 with more updates