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
Print cmd timer at end of output #3854
Comments
Not entirely related to the output issue, but is there any reason why you can't use the calculated variable |
Didn't know of that. The issue still stand though, but I'll use that var instead. |
The You could try to implement the PROMPT_SP hack in your |
I second the recommendation to use the prompt for this. Now, the fish shell project could add something like the PROMPT_SP hack (which, simplified, fills the current line with spaces and then resets the cursor onto the beginning of the next line) also to event-triggered functions, but that would add more code complexity and more noise to fish's output, and at the end you still shouldn't use these functions to output things because the ordering between them isn't defined (and we don't want to get into that business). In general, event-triggered functions should not be used for user-visible output, but should instead compute things in the background. |
That was one of the things I tried before posting here as well, but that isn't optimal with my terminal iTerm. It has a feature called mark, which will mark the first line of the prompt. Not a big technical problem ofcourse, but it doesn't look to good to mark the previous command's execution time instead of the prompt. Never heard of "PROMPT_SP" hack, but I'll look into it. But the fish_prompt does print at a new line no matter the output of the last command. So it's not impossible, but I guess that logic isn't easily available in scripts etc. outside the source code and compiled binaries. |
Honestly, if you absolutely have to do it this way I would just include an extra newline: |
Hello, for some time I have tried to get the following working:
POC:
This works great unless the command ends with a newline, but if I execute for example:
echo -n 'foobar'
the "$fish_cmd_diff" will be printed out on the same line as foobar.I've tried different methods and workaround (
stty -echo
,echo -en "\033[6n"
,commandline -f
, etc.) but not found a good solution.Can anyone help me out? This works in Bash, so I would love for something like this to work in fish as well.
Fish 2.5.0
iTerm2 v3
The text was updated successfully, but these errors were encountered: