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

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

Closed
joesanford opened this Issue Aug 19, 2015 · 29 comments

Comments

Projects
None yet
@joesanford
Copy link

joesanford commented Aug 19, 2015

This bug is still occurring with both multi-line and single-line prompts.

@faho

This comment has been minimized.

Copy link
Member

faho commented Aug 19, 2015

Could you add some more information? Which OS, which terminal, which fish version? What's your prompt? Any custom functions, especially signal handlers for SIGWINCH?

I cannot reproduce this on archlinux with konsole, fish 2.2.0-188-g3f43050, the classic+git prompt, a custom right-prompt and no custom SIGWINCH handlers.

@faho

This comment has been minimized.

Copy link
Member

faho commented Aug 19, 2015

Also no issue with the example in #321 - `printf '1\n2\n$'.

@joesanford

This comment has been minimized.

Copy link

joesanford commented Aug 24, 2015

Mac OS X 10.10.5. Was able to replicate with both iTerm2 and Terminal. fish 2.2.0. Prompts that have shown this are Pythonista and bira. 4 of us at my work can all replicate this (same environment).

No custom functions, and it occurs when resizing window of the terminal.

@Determinant

This comment has been minimized.

Copy link

Determinant commented Oct 30, 2015

Same issue here. It does not seem related to the OS X version, I tried on both 10.10.5 and 10.11. It occurs when resizing window of the terminal.

@faho

This comment has been minimized.

Copy link
Member

faho commented Oct 30, 2015

@Determinant, @joesanford: Can you try with current git master? It's possible this was already fixed since 2.2.0.

@Determinant

This comment has been minimized.

Copy link

Determinant commented Oct 30, 2015

Sorry, but I'm using 2.2.0. The problem still exists.

On Saturday, October 31, 2015, Fabian Homborg notifications@github.com
wrote:

@Determinant https://github.com/Determinant, @joesanford
https://github.com/joesanford: Can you try with current git master?
It's possible this was already fixed since 2.2.0.


Reply to this email directly or view it on GitHub
#2320 (comment)
.

--- This information is automatically generated ---
Welcome to My Blog : http://tedyin.com

ted.sybil aka. ymfoi aka. Ted Yin

@ridiculousfish ridiculousfish self-assigned this Oct 30, 2015

@faho

This comment has been minimized.

Copy link
Member

faho commented Oct 30, 2015

We know that you have this problem with 2.2.0, but what about newer versions (i.e. current git master, which isn't part of a release yet)?

@ridiculousfish

This comment has been minimized.

Copy link
Member

ridiculousfish commented Oct 30, 2015

I can reproduce on master.

The resizing stuff is rather tricky, but zsh seems to do much better here. I think what's going on is that we're soft-wrapping from the previous line, and need to have a hard return there.

@tylerhjones

This comment has been minimized.

Copy link

tylerhjones commented Feb 19, 2016

Is anyone else still receiving this problem?

@faho

This comment has been minimized.

Copy link
Member

faho commented Feb 19, 2016

I still can't reproduce - newest fish, newest konsole on archlinux.

@ixjlyons

This comment has been minimized.

Copy link

ixjlyons commented Mar 15, 2016

I'm not sure about Github notifications when an issue is referenced from another, but I wanted to point out the duplicate issue I filed #2816 (sorry for the dup -- I searched but didn't see this one). I'm able to replicate this issue with all terminal emulators based on recent (gtk3) versions of vte.

I filed a bug report against vte here, and one of the developers seemed to figure out what the problem was. See comment 4 specifically.

I'd love to contribute to fish, and I have some C++ knowledge, but I'm still learning the basics of how shells work. I implemented the vte dev's suggestion here, but I have no idea whether or not this will cause side effects. Tests seem to pass, and I'm using it as my daily driver without issue so far.

@joesanford

This comment has been minimized.

Copy link

joesanford commented Apr 11, 2016

@faho The problem still exists on master on Mac OS X 10.10 with iTerm2. Multiple users where I work can confirm as well with the same setup
screen shot 2016-04-11 at 10 08 57 am

@faho

This comment has been minimized.

Copy link
Member

faho commented Apr 11, 2016

@joesanford: Can you try erasing __fish_winch_handler? Unfortunately this means you'd need to run functions -e __fish_winch_handler interactively as it is defined only after the first prompt event (in __fish_config_interactive.fish), but it should do for a simple test.

The idea is that these terminals (iTerm2 and newer VTE) will reflow text themselves, so fish doing it just gets in the way. Or maybe their reflow doesn't work for our needs, let's see.

@zanchey

This comment has been minimized.

Copy link
Member

zanchey commented May 21, 2016

Sounds like we should try the patch suggested by the VTE developers.

@krader1961 krader1961 added this to the fish-future milestone Jul 3, 2016

@Eyenseo

This comment has been minimized.

Copy link

Eyenseo commented Aug 3, 2016

As reference for PR #3194

To reproduce the bug the prompt has to span over multiple lines. If the terminal is then resized the prompt will be partially overwritten (see @joesanford image).

My terminal is Termite which softwraps - the softwrapping is to blame for the partial repainting.

@0xbaadf00d

This comment has been minimized.

Copy link

0xbaadf00d commented Aug 11, 2016

Same issue with single line and right prompt enabled

image

@randomdude999

This comment has been minimized.

Copy link

randomdude999 commented Sep 10, 2016

@0xbaadf00d (I assume this happens when you shrinked the terminal window.) This happens with the right prompt probably because when you shrink the window, then the last character of the right prompt will be overflown into the next line. fish then proceeds to rewrite the prompt, but does not go to the previous line and writes it one the current one instead. This means that there is a bunch of garbage on the previous line that fish doesn't even know about. (This also happens to me a lot sometimes.)

@tamasgal

This comment has been minimized.

Copy link

tamasgal commented Oct 8, 2016

I just wanted to let you know that this problem also exists in zsh for years, and almost every ohmyzsh theme I tested. The glitch also occurs on many single line prompts. I am "living" with this glitch for a couple of years already, from Mac OS 10.7 up to 10.12, using iTerm, iTerm2 and Terminal.app
I thought I could try fish to finally get rid of this and landed here ;)

EDIT: I just found this forum post about the same problem and I thought it would be helpful to tell you that the workaround fixed the issue for me. I can't believe that I found a solution after so many years...

The idea is to let the prompt act as a single line and do a simple print using a specific function which is called by zsh before drawing the actual prompt. This may work for the fish-shell as well, I guess?
Otherwise, sorry for the spam!

@newzubakhin

This comment has been minimized.

Copy link

newzubakhin commented Jan 22, 2017

The problem is still relevant.
Terminal emulator -- Sakura
2017-01-22-032045_700x419_scrot

urxvt
2017-01-22-032344_423x266_scrot

@skerit

This comment has been minimized.

Copy link

skerit commented Jul 3, 2017

This issue is still present in v2.6.0

@c02y

This comment has been minimized.

Copy link

c02y commented Jul 25, 2017

This issue is still not fixed, environment:

fish-shell v2.6.0
Konsole v2.3.3
CentOS 6.5 32-bit
TERM: xterm-256color

This annoy me for a long time (at least over a year), so I try to find a solution just now, and searching for solution leads me to this page.

Alternative solution:
When resizing panes(I'm using shortcuts of tmux to resize the panes or mouse to resize the whole terminal window), clear the other panes in the current window, but this is not a good solution.

Not only when resizing panes, but when splitting current pane, there's something wrong with the prompt.

faho added a commit to faho/fish-shell that referenced this issue Jul 25, 2017

Fix clearing abandoned line with VTE
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

This comment has been minimized.

Copy link
Member

faho commented Jul 25, 2017

Konsole v2.3.3

@c02y: Are you sure that's the version? Because according to https://cgit.kde.org/konsole.git/refs/tags, version 3.0.5 was released 15 years ago.

I can confirm that this does not happen with an up-to-date konsole, and I don't think we want to support terminals that are 15 years out of date.

Anyway, please test #4243.

@c02y

This comment has been minimized.

Copy link

c02y commented Jul 26, 2017

@faho yes, Konsole v2.3.3, I'm using Linux Box in my company, and it is a very old of Linux distribution, it is chosen by my software development, I can not use the latest one.

snapshot1

About the test, I installed (using yum) the stable version of fish-shell which is currently v2.6.0 from a repo for my version of Linux, and I cannot compile and install it from the source code directly since compiling requires higher version of tools.

g++ v4.4.7
clang++ v3.4.2
autoconf v2.69
automake v1.15

=============
UPDATE:

It took a while to install new version of gcc/g++ in my CentOS6.5 (instructions from link.

Before installing the #4243.
recorded1
recorded0

After installing the #4243. I cannot say that it is fixed.
recorded4
recorded3

I'll let you know the result of another test in Fedora (new version of Konsole) when I get home.

@c02y

This comment has been minimized.

Copy link

c02y commented Jul 26, 2017

This is the result of new konsole after installing the #4243.
Konsole v16.12.3

recorded

recorded

I don't think it is fixed.

@faho

This comment has been minimized.

Copy link
Member

faho commented Jul 27, 2017

@c02y: What's your fish_prompt function? Can you try without fish_right_prompt?

That is still broken for VTE-based terminals for me, so it's to be expected.

This here is specifically about the "multi-line" case.

@faho faho closed this in #4243 Aug 9, 2017

faho added a commit that referenced this issue Aug 9, 2017

Fix clearing abandoned line with VTE (#4243)
* Fix clearing abandoned line with VTE

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.

* Use terminfo definition instead of hardcoding

Thanks to @ixjlyons.

@faho faho modified the milestones: fish-future, fish 2.7.0 Aug 9, 2017

@zanchey zanchey reopened this Aug 10, 2017

@zanchey zanchey reopened this Aug 15, 2017

@c02y

This comment has been minimized.

Copy link

c02y commented Aug 15, 2017

@faho It works good without fish_right_prompt.

@zanchey zanchey modified the milestones: fish-future, fish 2.7.0 Sep 4, 2017

@truenicoco

This comment has been minimized.

Copy link

truenicoco commented Mar 9, 2018

Experiencing similar issue here with Fedora 27, i3-gaps 4.14.1 and xfce4-terminal 0.8.6 (Xfce 4.12).

@V0idk

This comment has been minimized.

Copy link

V0idk commented May 8, 2018

@faho so what's the solution? the pythonista.fish do not have the fish_right_prompt but has the same problem

@faho faho closed this in e35d248 May 8, 2018

@faho

This comment has been minimized.

Copy link
Member

faho commented May 8, 2018

It turns out the crashes in the test suite we've been getting with the previous attempts were because that sets $TERM to dumb. So we don't do this in dumb terminals, where it shouldn't have an effect anyway.

@V0idk: Rebuild fish with e35d248.

@faho faho modified the milestones: fish-future, fish-3.0 Sep 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment