Skip to content

Fix clearing abandoned line with VTE - #4243

Merged
faho merged 2 commits into
fish-shell:masterfrom
faho:fix-multiline-prompts
Aug 9, 2017
Merged

faho merged 2 commits into
fish-shell:masterfrom
faho:fix-multiline-prompts

Conversation

@faho

@faho faho commented Jul 25, 2017

Copy link
Copy Markdown
Member

With VTE-based terminals, resizing currently causes multi-line prompts
to go weird.

This changes the sequence we use to clear the line to one suggested by
a VTE
developer (https://bugzilla.gnome.org/show_bug.cgi?id=763390#c4).

It changes nothing in konsole 17.04.3 and urxvt 9.22, but they already
work.

Note that this does not fix the case where output did not end in a
newline, but that doesn't seem to be up to us. Also, it only affects
those lines.

Fixes #2320.

TODOs:

  • [N/A] Changes to fish usage are reflected in user documentation/manpages.
  • [N/A] Tests have been added for regressions fixed
  • [N/A] User-visible changes noted in CHANGELOG.md

With VTE-based terminals, resizing currently causes multi-line prompts
to go weird.

This changes the sequence we use to clear the line to one suggested by
a VTE
developer (https://bugzilla.gnome.org/show_bug.cgi?id=763390#c4).

It changes nothing in konsole 17.04.3 and urxvt 9.22, but they already
work.

Note that this does not fix the case where output did not end in a
newline, but that doesn't seem to be up to us. Also, it only affects
those lines.

Fixes fish-shell#2320.
@faho faho added the bug Something that's not working as intended label Jul 25, 2017
@faho faho added this to the fish 2.7.0 milestone Jul 25, 2017
@faho

faho commented Jul 25, 2017

Copy link
Copy Markdown
Member Author

I tested this in

  • konsole and urxvt (both working before and after)

  • sakura and mate-terminal (both broken before, working after unless there's output that doesn't end in a newline)

Also note that right prompts are broken in sakura and mate-terminal.

@floam

floam commented Jul 25, 2017 •

Copy link
Copy Markdown
Member

I think we only forced the string of "[2K" because curses didn't have it in terminfo. For the more typical "[K" you can get that escape where it's valid via the terminfo definition (like the other stuff we append(), a few lines above in that code.)

@faho

faho commented Jul 25, 2017

Copy link
Copy Markdown
Member Author

Sure, what's the tparm invocation?

@floam

floam commented Jul 26, 2017

Copy link
Copy Markdown
Member

You don't need to use tparm. Can just use clr_eol as-is.

@floam

floam commented Jul 26, 2017

Copy link
Copy Markdown
Member

As in, abandon_line_string.append(clr_eol);.

@krader1961

Copy link
Copy Markdown
Contributor

Any reason not to merge this?

@zanchey

zanchey commented Aug 9, 2017 •

Copy link
Copy Markdown
Member

I think @faho was going to update it with @floam's changes.

@faho

faho commented Aug 9, 2017

Copy link
Copy Markdown
Member Author

I think @faho was going to update it with @floam's changes.

Yes. Sorry for the delay.

The issue I still have is that this isn't a complete fix, so it's likely to break something else. This kind of stuff is really fragile because of the fifty million terminals available.

Cases it does not fix:

  • right prompt in at least konsole and mate-terminal (vte) - though mate-terminal can't handle right prompts properly anyway.

  • tmux with or without right prompt in konsole and mate-terminal.

  • old and crusty terminals

However, it fixes the case without right prompt and tmux in any vte-based term I've tried (and whether we are responsible for the issue with tmux requires further research), and I cannot find any case it makes worse. Plus, we're backed up on this by a vte developer.

So: I'm merging this.

@faho
faho merged commit 09cb31a into fish-shell:master Aug 9, 2017
faho added a commit that referenced this pull request Aug 10, 2017
Unfortunately, this breaks the expect tests.

So, until I can figure out how to unbreak them:

This reverts commit 09cb31a.
@faho

faho commented Aug 10, 2017

Copy link
Copy Markdown
Member Author

This needs to be readded since I've reverted it because it breaks the expect tests. So far I haven't found where this sequence is checked there, so I haven't figured out how to fix it.

@zanchey zanchey removed this from the fish 2.7.0 milestone Sep 4, 2017
@faho faho self-assigned this Nov 16, 2017
faho added a commit to faho/fish-shell that referenced this pull request Mar 9, 2018
faho added a commit to faho/fish-shell that referenced this pull request May 8, 2018
faho added a commit that referenced this pull request May 8, 2018
Turns out the segfaults we've been getting in our tests are because we set $TERM to "dumb".

So we only clear the line if the terminal isn't dumb.

This reverts commit 745a88f.

Fixes #2320.
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something that's not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-line prompts are repeated when the terminal window is resized. (repeat of #321)

4 participants