Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal protocols spew a *lot* of output #10494

Closed
faho opened this issue May 14, 2024 · 0 comments
Closed

Terminal protocols spew a *lot* of output #10494

faho opened this issue May 14, 2024 · 0 comments
Labels
regression Something that used to work, but was broken, especially between releases
Milestone

Comments

@faho
Copy link
Member

faho commented May 14, 2024

We now enable "terminal protocols", like bracketed paste, CSI u key codes etc.

This was always going to lead to more output to the terminal, which is overall fine - we've always been pretty chatty (highlighting, suggestions, etc).

But I think the current state may be a bit much. It'll not only adversely impact performance (especially over ssh), but is also in the way when you look at a log like with script or asciinema.

As it stands, starting fish --no-config and running echo foobar prints on the order of ~1500 bytes (3.7.1 does ~800 bytes) - counted with script and wc -c.

In particular, it will apparently enable and disable protocols multiple times before it even gets to the input - I count 8 times before it gets to the prompt (in --no-config mode).

Most of this is down to toggling it in parser::eval_node:

fish-shell/src/parser.rs

Lines 565 to 581 in e7f13ac

// If interactive or inside noninteractive builtin read.
let terminal_protocols_enabled = TERMINAL_PROTOCOLS.get().borrow().is_some();
let terminal_protocols_disabled =
terminal_protocols_enabled.then(terminal_protocols_disable_scoped);
// Check the exec count so we know if anything got executed.
let prev_exec_count = self.libdata().pods.exec_count;
let prev_status_count = self.libdata().pods.status_count;
let reason =
self.execution_context()
.as_ref()
.unwrap()
.eval_node(&op_ctx, node, Some(scope_block));
let new_exec_count = self.libdata().pods.exec_count;
let new_status_count = self.libdata().pods.status_count;
drop(terminal_protocols_disabled);

Remove it and we're down to ~980 bytes, which would be reasonable.

@krobelus Is that one necessary? Is there a better spot to put it? It strikes me as suspect to do it there.

@faho faho added the regression Something that used to work, but was broken, especially between releases label May 14, 2024
@faho faho added this to the fish next-3.x milestone May 14, 2024
@krobelus krobelus assigned krobelus and unassigned krobelus May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Something that used to work, but was broken, especially between releases
Projects
None yet
Development

No branches or pull requests

2 participants