This is a terminal feature where pastes will be "bracketed" in
\e\[200~ and \e\[201~.
It is more of a "security" measure (since particularly copying from a
browser can copy text different from what the user sees, which might
be malicious) than a performance optimization.
Work towards #967.
I hate doing this but I am tired of touching a fish script as part of
some change and having `make style` radically change it. Which makes
editing fish scripts more painful than it needs to be. It is time to do
a wholesale reformatting of these scripts to conform to the documented
style as implemented by the `fish_indent` program.
these modern terminals both compose a nicer title if we don't try to provide a custom one (no path in title twice, "fish" in title twice) - and the user can configure which components they'd like in their terminal inside the terminal preferences.
Also make test "$VTE_VERSION" -ge .. work once I commit `test` strtoi
fix - the trick is to add a zero before it so the numeric comparison
works even if it's empty.
Fixes#107
This has the same name and path as ubuntu's, but takes less arguments.
So we need to actually find if the distro thinks it is suse, and then
use it.
Fixes#3366.
Adds a color reset thing, to ensure fish tries to use hard colors during
testing.
Also, work on a discrepancy (not introduced by my changes, afaik) when
with some combinations of color settings, and usage of --bold, caused super
flakey color paninting in the pager. Downwards movements that trigger
scrolling vs. upwards movement in the pager would only apply bold to
selections when moving upwards. The bold state of the command completions in
the pager was flipping flops on and off, depending on if there is a description
on the preceding line.
Implement a lame fix by reseting the color to normal and applying a
different style on the rightmost ')' which seems to be what was influencing it.
Makes fish use terminfo for coloring the newline glich char.
Implementing the --shadow-builtin flag has proven to be highly controversial.
Revert the introduction of that flag to the `function` command. If someone
shoots themselves in the foot by redefining a builtin as a function that's
their problem and not our responsibility to protect them from doing so.
Fixes#3319
Fish assumed that it could use tparm to emit escapes to set colors
as long as the color was under 16 or max_colors from terminfo was 256::
if (idx < 16 || term256_support_is_native()) {
// Use tparm to emit color escape
writembs(tparm(todo, idx);
If a terminal has max_colors = 8, here is what happenened, except
inside fish:
> env TERM=xterm tput setaf 7 | xxd
00000000: 1b5b 3337 6d .[37m
> env TERM=xterm tput setaf 9 | xxd
00000000: 1b5b 3338 6d .[39m
The first escape is good, that second escape is not valid.
Bright colors should start at \e[90m:
> env TERM=xterm-16color tput setaf 9 | xxd
00000000: 1b5b 3931 6d .[91m
This is what caused "white" not to work in #3176 in Terminal.app, and
obviously isn't good for real low-color terminals either.
So we replace the term256_support_is_native(), which just checked if
max_colors is 256 or not, with a function that takes an argument and
checks terminfo for that to see if tparm can handle it. We only use this
test, because otherwise, tparm should be expected to output garbage:
/// Returns true if we think tparm can handle outputting a color index
static bool term_supports_color_natively(unsigned int c) { return max_colors >= c; }
...
if (term_supports_color_natively(idx) {
And if terminfo can't do it, the "forced" escapes no longer use the fancy
format when handling colors under 16, as this is not going to be compatible with
low color terminals. The code before used:
else {
char buff[16] = "";
snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);
I added an intermediate format for colors 0-15:
else {
// We are attempting to bypass the term here. Generate the ANSI escape sequence ourself.
char buff[16] = "";
if (idx < 16) {
snprintf(buff, sizeof buff, "\x1b[%dm", ((idx > 7) ? 82 : 30) + idx + !is_fg * 10);
} else {
snprintf(buff, sizeof buff, "\x1b[%d;5;%dm", is_fg ? 38 : 48, idx);
}
Restores harmony to white, brwhite, brblack, black color names.
We don't want "white" to refer to color color #16, but to the
standard color #8. #16 is "brwhite".
Move comments from output.h to output.cpp
Nuke the config.fish set_color hack for linux VTs.
Sync up our various incomplete color lists and fix all color values.
Colors 0-8 are assumed to be brights - e.g. red was FF0000. Perplexing!
Using this table:
<http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html>
Fixes#3176
This is a regression introduced by 834ebef53c
Bolster with a check for only login sessions too -- hopefully makes it
less annooying on subshells in general.
Fixes#3261
This potentially leads to an unusable session (when fish_key_bindings is
set in config.fish to a value without corresponding function), so we
should take care.
It's currently too easy for someone to bork their shell by doing something
like `function test; return 0; end`. That's obviously a silly, contrived,
example but the point is that novice users who learn about functions are
prone to do something like that without realizing it will bork the shell. Even
expert users who know about the `test` builtin might forget that, say, `pwd`
is a builtin.
This change adds a `--shadow-builtin` flag that must be specified to
indicate you know what you're doing.
Fixes#3000
I'm going to modify these functions as part of dealing with issue #3000
and don't want those changes to be masked by running the files through
`make style`.
* Add missing color definitions to __fish_init_1_50_0 reset.
The values where determined by inspecting the values of:
* fish_color_end
* fish_color_user
* fish_color_host
after resetting the color theme via fish_config.
* Add documentation for fish_color_user and fish_color_host.
It used to be that way and we recommend `set fish_greeting` (i.e. set to
empty) in the docs - possibly since we check if the variable is defined
on upgrade.
Unfortunately, nvim will, even when running in a terminal that supports
it, swallow the sequences whole, rendering the displayed text _white_.
This means falling back to 256 colors is the lesser evil as at least a
blue-ish color will display as blue while a red-ish will be red, instead
of both showing white.
nvim's behavior does _not_ change depending on
$NVIM_TUI_ENABLE_TRUE_COLOR or any other option I could find and neovim-qt
exhibits the same behavior.
Fixes#2600.
This patch is currently floated from the NixOS side as part of
https://github.com/NixOS/nixpkgs/pull/12000, but prior versions of the
hook ignore anything but the first argument anyway, so this is
backwards-compatible.
This skips the weird dance where we'd define a simple handler and then
later overwrite with a fancier one, once the first event came in.
It turns out that isn't necessary, as it doesn't actually improve
startup speed because the checks needed to define fancier handlers are fast.
In case we are non-interactive, still define the simple handler, and
keep the default handler for users to switch to.
Unfortunately, there's no standard way to detect support (importantly,
terminfo doesn't encode it), but there's a variety of terminals that
support it that we can detect.
It's better than letting this functionality go to waste.
Check KONSOLE_PROFILE_NAME instead of DBUS_SESSION because Konsole can be compiled without dbus support.
Check ITERM_SESSION_ID's format for 24bit support
This has changed since the last release, just like 24bit support. So if
we check one, we get the other.
fish_user_key_bindings is the user's, and they should know if they want
vi-ish bindings or emacs-ish (or nano-ish). If they want to define
multiple, they can also do that (e.g. via checking what
$fish_key_bindings is set to).
Fixes#2254
CC @kballard