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

Weird '⏎ ' character printed when fish start #7893

Closed
nemya9066 opened this issue Apr 2, 2021 · 14 comments
Closed

Weird '⏎ ' character printed when fish start #7893

nemya9066 opened this issue Apr 2, 2021 · 14 comments

Comments

@nemya9066
Copy link

nemya9066 commented Apr 2, 2021

Version: 3.2.1
OS: arch linux
WM: awesomewm
TERM: alacritty

I decided to finally give fish a try today loving it so far exept one annoying problem when I start fish(by using alacritty -e fish) sometime if the window isn't taking the entire scree this weird charcter appear:
2021-04-02-00:52:08

Like I said this doesn't happen if fish is the only window on the screen I found it to be related to the width of the window I also noticed that if I fullscreen the window it appear like this and after getting out of fullscreen the character disappear.
2021-04-02-00:57:58

Right now I'm thinking this is a SIGWINCH issue so I tried other wm that I have on the system bspwm and dwm and i3 had the same, other terminal didn't make a difference.
Trying fish without third-party customizations didn't totally remove the problem but it make it happen less.
I don't know that much about fish I just switched today so I ran ripgrep '⏎ ' on /usr/share/fish and found one occurence related to fish_status_to_signal.
I remember having a similar issue with zsh long time ago I had it removed by removing these options in my zshrc:
unsetopt prompt_cr prompt_sp

I know this is a pretty weird issue but I hope some one can share some insights thank you.

krobelus added a commit that referenced this issue Apr 2, 2021
@krobelus
Copy link
Member

krobelus commented Apr 2, 2021

Sounds a bit like #7015.

@nemya9066
Copy link
Author

nemya9066 commented Apr 2, 2021

Hey thanks for replying I checked your commit about the 'omitted_newline_str' variable so I downloaded the source code and started seeing where that variable is being used eventually with trial and error I found that this piece of code is responsible for my issue:
const std::string narrow_abandon_line_string = wcs2string(abandon_line_string);
write_loop(STDOUT_FILENO, narrow_abandon_line_string.c_str(),
narrow_abandon_line_string.size());
s->actual.cursor.x = 0;

It's line 1302-1305 in the screen.cpp file in the current master. If I comment that piece of code out the '⏎' character no longer appear for me.
Can't say if this fix the issue for everyone else but for me it's working for now.
Also I installed fish from source if I want to remove it how can I do so make uninstall say that there is no uninstall rule?

@krobelus
Copy link
Member

krobelus commented Apr 2, 2021

I can reproduce, also with other terminals like Konsole.

Also I installed fish from source if I want to remove it how can I do so make uninstall say that there is no uninstall rule?

I think removing all the files in /usr/local/{bin,share,share/doc}/fish* should cover files that are installed by make install`.
Most functionality works without install - you can run fish directly from the build folder.

@ridiculousfish
Copy link
Member

krobelus can you share your steps to reproduce? I wasn't able to repro on my own.

@krobelus
Copy link
Member

krobelus commented Apr 4, 2021

I believe this depends on how some window managers resize new windows.

First launch an isolated window manager (this should even work from within X11.):

SWAYSOCK=temp-sway-socket sway

Then simultaneously launch a couple of terminal windows inside the window manager. They should be arranged in 6 columns.

for i in (seq 6)
    SWAYSOCK=temp-sway-socket swaymsg exec -- alacritty -e fish
end

Sometimes it takes a few attempts to reproduce, but it happens more often than not.

@zanchey zanchey added this to the fish-future milestone Apr 4, 2021
@szbernat
Copy link

I have the same issue with version 3.2.1, however with 3.1.2 I never experienced this. Could it have been introduced with the recent updates? I guess I will keep using 3.1.2 until this is fixed.

OS: Manjaro Linux
WM: Qtile
TERM: alacritty

@faho
Copy link
Member

faho commented Apr 10, 2021

To put the prompt on a new line and to mark when a command didn't end in a new line, fish does a trick to print an and erase it again.

It seems that, in this case, the terminal is resized between calculating the width and printing/erasing it, so fish ends up miscalculating and ends up on the next (empty) line, erasing that instead.

Previously this could possibly have worked because fish would handle the reflow calculations, but because that clashes with the terminal's reflow, we removed it in terminals that handle their own reflow, including alacritty.

Now, the fix here is probably to not print before fish has actually started up - it's not meant for fish's startup, it's meant for external commands that don't print a newline.

@nemya9066
Copy link
Author

nemya9066 commented Apr 10, 2021

@szbernat Please try testing my fork of fish to see if it fix the issue for you https://github.com/nemya9066/fish-shell (It did for me).
And does someone exactly know what the purpose of the code commented out here nemya9066@d0485ab is to know if it's safe to remove?

@faho
Copy link
Member

faho commented Apr 10, 2021

@szbernat Please try testing my fork of fish to see if it fix the issue for you https://github.com/nemya9066/fish-shell (It did for me).

@nemya9066 Of course that will "fix" it, that removes the feature that prints "⏎"!

However we like the feature, it is good and important, so we're going to keep it in, and see that it doesn't trigger in this case.

@faho faho modified the milestones: fish-future, fish 3.3.0 Apr 10, 2021
@faho faho closed this as completed in bc4d597 Apr 10, 2021
@faho
Copy link
Member

faho commented Apr 10, 2021

Alright I made it so fish doesn't print "⏎" before the first prompt, should be fixed now.

@szbernat
Copy link

I can confirm that bc4d597 solves this issue for me.

Thanks for the quick fix, now I like fish even more.

@smason
Copy link

smason commented Apr 14, 2021

have also been affected this bug in version 3.2.1, but didn't see this issue until I asked about on SO

I rebuilt from master (i.e. including bc4d597) and the issue went away

as a test, I removed the call to s_reset_abandoning_line on first_prompt and I still don't see this bug, so I'd assume there was something else provoking the behaviour in 3.2.1 (I rebuilt after checking out tags/3.2.1 to make sure it wasn't anything to do with packaging under archlinux)

@faho
Copy link
Member

faho commented Apr 14, 2021

as a test, I removed the call to s_reset_abandoning_line on first_prompt and I still don't see this bug,

That's... exactly the wrong way around. Previously that would be called even if it was the first prompt, so you want to remove the `if``, not the call itself.

@smason
Copy link

smason commented Apr 14, 2021

as a test, I removed the call to s_reset_abandoning_line on first_prompt and I still don't see this bug,

That's... exactly the wrong way around. Previously that would be called even if it was the first prompt, so you want to remove the `if``, not the call itself.

whoops, I read the function name as working the other way around… at least I described what I did unambiguously enough!

rebuilding with and without this change does indeed toggle the behaviour, sorry for the noise and thanks for fish!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

7 participants