-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fish prints new lines when entering text #2859
Comments
I'm sorry, the image doesn't help much. Is it that you just "randomly" get that "test: Missing argument at index 2"? That tells me some fish script has a test invocation that isn't correct for you (most likely because a variable is unset in your environment). This fish script might be in a completion (which are run to feed into suggestions). If it's not that, please try to explain again. |
The behavior he is trying to report is most easily noticed by looking at the "ech"... lines - you can get a temporal sense of what he experienced from that as he couldn't have caused that exact result by hitting enter and that autosuggestion is there. He typed "ech", there was an autosuggestion, and then for some reason a new prompt was printed on him down below. But we don't really know what's going wrong aside from the test error - the main thing multiline prompts seem to do is print themselves too too much whenever everything isn't just right. Solve whatever is bombing out in windows for you in whatever script that is and you probably solve your glitch. |
Oooh, that's it! @SamTebbs33: Can you start |
@faho @floam Here is perhaps a more representative image of the problem. Note that all I am doing is typing out "echo "hello"" and fish is printing out the prompt several times over. |
Please do run it with -d 3 and also let me know which prompt that is? Can you upload the actual .fish file you defined it in to here? |
Unfortunately that doesn't have anything of value. Can you give us your configuration files (preferably all of them, including the fishd file)? |
Thanks but I can't see anything in there giving a hint as to that failing
Wouldn't hurt, you can copy and paste the text instead of doing a screenshot. But we can see that the trace doesn't have anything to offer regarding of what is going on when you actually have the weird highlighting.and duplicating prompts. |
What's with the bash error in the first screenshot? Are you running fish under bash? |
Duh! It's choking on a carriage return there - perhaps you edited some files in notepad/wordpad? That will use the wrong kinds of line endings that unix utilities will not expect. Run all your scripts through dos2unix and see what happens. Convert over that bash shell script cygwin is I guess running before it loads fish in order to initialize an environment, and also any fish scripts you've edited. A decent text editor that should be safe to use that is available on Windows for free is Notepad++. |
Yes, we do. In particular that screen capture doesn't include the error message. However, for this don't use screen captures. They're too hard to read and we can't use normal text processing tools to examine them. Instead use the Also, like @floam mentioned, if you're editing your fish files with notepad or a similar program that insists on inserting CRLF pairs that will cause lots of problem. Either run the resulting files through |
I ran the script command, entered fish, tried to reproduce the problem and then ran Here are my fish files from the "config/fish" directory: https://github.com/SamTebbs33/fish_files |
Thanks for taking the time to collect and make available these files in a git repo Sam. Very easy to clone over git and with no worries that something converted the line endings in the mix, like if you had pasted the code into the text box on this issue. |
The problem is due to this line in your prompt.fish:
If you're not in a git repo
or use the fish idiom to see if the var has at least one value
Also, in fish the |
FWIW, To verify what I said above you only need to
|
@krader1961 Thanks for the help! I amended my mistake in not surrounding the variable with speech marks, but the problem with the prompt is persisting. |
Okay, so there's two problems, one of which you fixed. The main issue here (the weird prompt-showing-up-again-and-again) might be related to your history (which we check for suggestions) - can you post your history file? I'm not sure where it is under windows, with 2.2.0 it should be a file called "fish_history" in the same directory as your config.fish. |
@faho Here it is! |
@SamTebbs33: I'm not sure it's the same issue, but when running with your history file, my fish hangs. Converting it to unix line endings makes it work. Maybe try that? |
@faho Nope, the prompt is still being re-printed! |
@SamTebbs33: I installed most of your environment on my machine. Your prompt works just fine for me. I'm willing to bet the problem is with the escape sequences fish is emitting when it draws your left and right prompts. I noticed from your problem statement and the fish debug output that you're running fish under Cygwin. Do you see this problem on a Linux or other UNIX distro? What terminal are you using? You said cygwin but I thought you needed to use msys, mintty, or something similar to get a unix like terminal emulator under cygwin. What does |
Also, I noticed in the config files you uploaded you have a functions/fish_prompt.fish file and a dotfiles/prompt.fish which defines the |
Sorry for the lack in a reply, I have been and will be visiting family until later this month. I will get back to the issue once I once again have access to my pc! |
To bring in some info from #2003, and some testing I just did:
The easiest way to reproduce is to run the following at an interactive fish shell, running on cygwin
|
I propose an experiment: build fish without the code that writes the char sequence that attempts to ensure the prompt never overwrites output that does not end with a newline. I'm happy to write a patch but someone else will have to compile and test it since I don't have a MS Windows machine setup for development. |
krader1961, I built fish (on cygwin) without the code that causes #789, and that problem no longer occurs. However, the repeating multi-line prompt does occur (I'm using ConEmu, not mintty). I have double checked that my fish_prompt file uses unix style line endings, and when I run fish with -d 3 the only thing I see is that path_get_path gets called a lot (but that's the case for a single line prompt as well). I would be happy to test some things out in Sam's absence so we can make progress on this. |
@barksdml: Do you have the Also, what does |
@krader1961 Here is the file output by
As you can see, line1 was never supposed to have a |
@krader1961 Repeating multi-line prompt occurs on my setup as well, let me know how I can help out. With Testing with:
If no
Fish 2.2.0, Cygwin 2.874 (64 bit) on Win7, mintty. Screen (I just pressed a bunch of "s", I did not press enter): |
I'm back at my PC, what else can I do? |
I installed a copy of Windows 10 so I could explore the new Windows Subsystem for Linux. I also installed the latest Cygwin. I am able to reproduce the problem in both environments. TERM is xterm in both. Running
The "<" lines are OS X, the ">" lines Windows xterm settings. The output captured by the |
The problem is that |
A lot of googling didn't yield any answers. But empirical testing shows that that the MS Windows tty has a single timestamp updated when anything is written by a program or typed by the user. That breaks a fundamental assumption made by the fish code. |
It's worse than I thought. The tty device doesn't even have a single activity timestamp. The |
The tty device timestamps on MS Windows aren't usable because they're always the current time. So fish can't use them to decide if the entire prompt needs to be repainted. Fixes #2859
The tty device timestamps on MS Windows aren't usable because they're always the current time. So fish can't use them to decide if the entire prompt needs to be repainted. Fixes fish-shell#2859
I can confirm that the latest update installed with Cygwin has fixed the issue. Thanks for sorting it out! |
The fixed version does not seem to be updated to the apt-get servers. I tried using apt-get to install fish into the Windows 10 Linux subsystem and the bug is present. |
@SamTebbs33: That of course depends on which repository you use. If you use Ubuntu 16.04's repos, you'll get 2.2.0. You need to add our PPA to get 2.3.1. |
When entering text into the prompt, fish seems to arbitrarily print new lines, and it sometimes hides text.
Reproduction Steps:
Expected behavior:
The shell should only go on to a new line when pressing the enter key.
Observed behavior:
It goes on to a new line arbitrarily when entering text.
In the above image, I continued to enter the command "echo "hello"" and during this fish went on to a new line arbitrarily and hid the text when I closed the speech marks.
Additional information:
This has happened ever since I installed fish.
Fish version: 2.2.0
Operating system: Windows 10 with Cygwin
Terminal or terminal emulator: Cygwin
For 2.3.1 release:
The text was updated successfully, but these errors were encountered: