Comments (8)
Excitingly, this does not happen in git main at 4c1e25b, but the set_color
invocation does not work quite right (eg echo What color is the date\? (set_color yellow; date +%T; set_color blue)
has a blue date, not a yellow one).
from fish-shell.
Weird... that's not what happens for me.
For reference, here's my fish_greeting.fish file.
function fish_greeting
echo Hello friend!
echo The time is (set_color yellow; date +%T; set_color blue) and this machine is called $hostname
end
(I know the text doesn't look blue, but that's what blue is in my palette.)
from fish-shell.
Sorry, I see the behaviour you describe, but only on 3.6.4 and not in main, where it is different but also wrong.
from fish-shell.
Is 3.6.4 not the latest release...? I tried upgrading fish (using Homebrew) but 3.6.4 is the latest version available. Or is main not the same?
from fish-shell.
3.6.4 is the most recent release, but main includes a substantial port of the internals of fish, which has fixed some longstanding bugs but also introduced new ones.
from fish-shell.
the color change bisects to ce559bc (cc @mqudsi)
from fish-shell.
I've fixed the color.
The extra space happens because
$ echo (echo 1; set_color blue) 2
is equivalent(*) to
$ echo (echo 1; echo -n \e\[34m) 2
or
$ echo (echo 1\n\e\[34m) 2
fish trims trailing newlines from command substitution output.
There is no trailing newline here. echo
will print both lines separated by a space. The second line is empty.
We could try to remove the last \n if it's followed by only invisible character sequences but that sounds confusing.
Probably best to work around it on your end
(*) found with
$ set_color blue | string escape
\e\[34m⏎
from fish-shell.
Possibly we should fix the tutorial, but it's inelegant. echo The time is (set_color yellow)(date +%T)(set_color normal) now
is the best I can do, but runs into our old friend Cartesian expansion if set_color
produces no output.
from fish-shell.
Related Issues (20)
- Command not found function not called in certain case HOT 1
- Completion seems not to work with when quoted string doesn't have the closing quote HOT 2
- `alt+left` and `alt+right` keybinds no longer work HOT 5
- OSC52 Copying doesn't work HOT 2
- Completion for run0 command is missing
- A key or a keyboard shortcut to expand variables HOT 2
- fish/functions/*.fish only show their description after they are lazy loaded HOT 3
- default flatpak autocompletions load up incorrect completions for package names HOT 1
- Terminals and keyboard protocols survey HOT 16
- No easy way to install fish on Amazon Linux 2023 HOT 4
- Error no such file file:///use/share/doc/fish/index.html when run "help" HOT 8
- Question: How to bind a key that set the vi mode from visual to normal? HOT 1
- Fish shell path globbing should work in command line options HOT 1
- Cursor won't change shape depending on vi mode when running inside the integrated terminal of VSCode HOT 2
- `fish_config prompt save prompt_name` retains the previous right prompt
- Autocomplete shows files that aren't there HOT 1
- Is it possible to switch the behavior of Right Arrow and CTRL - Right Arrow for accepting one word of autosuggestion versus the whole suggestion? HOT 2
- [Feature Request]: Add q directive support to printf function HOT 5
- Truncated process name in `killall` completion HOT 3
- `__fish_macos_set_env` does not handle lines with colons HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fish-shell.