Commit Graph

3105 Commits

Author SHA1 Message Date
Fabian Homborg
86a6a205e7 set_color: Don't error with "-b" and no argument
We already don't print an error with just `set_color`, so it should be
consistent.

Fixes #7154

(also removes an impossible exit)
2020-06-26 20:59:17 +02:00
Mahmoud Al-Qudsi
4ba9e70f9a Remove extraneous line break in the middle of an error message 2020-06-25 23:01:59 -05:00
Mahmoud Al-Qudsi
34b918d0a0 Reduce unneeded calls to tcgetpgrp
After profiling bottlenecks in job execution, the calls to `tcgetpgrp`
were identified to take a good amount of the execution time. Collecting
metrics on which branches were taken revealed that in all "normal"
cases, there is no benefit to calling `tcgetpgrp` before calling
`tcsetpgrp` as it can instead be called only in the error case to
determine what sort of error handling behavior should be applied.

This makes the best-case scenario of a single syscall much more likely
than in the previous situation.
2020-06-25 22:46:09 -05:00
Mahmoud Al-Qudsi
c3849ebeba Convert var_table_t to an unordered_map
Profiling revealed string comparison in variable lookups to be a
significant hotspot. This change causes `make test` to complete ~4.5%
faster per `hyperfine`.
2020-06-25 00:56:49 -05:00
Mahmoud Al-Qudsi
a5be15da69 Optimize lookup of electric variables 2020-06-24 22:46:02 -05:00
Mahmoud Al-Qudsi
9bddd78239 fixup! Eliminate recursive calculation of string length in wildcard matching
This was originally comparing two pointers for equality but after the
refactor to wcstring it ended up comparing a const string pointer to the
_contents_ of the wcstring.
2020-06-24 21:53:05 -05:00
Mahmoud Al-Qudsi
bfa17ecff6 Fix call site for wildcard_match_internal 2020-06-24 21:23:18 -05:00
Mahmoud Al-Qudsi
a6f1e6119b Eliminate recursive calculation of string length in wildcard matching 2020-06-24 17:21:18 -05:00
Fabian Homborg
149a0b98af Another formatting run
I really kinda hate how insistent clang-format is to have line
breaks *IFF THE LINE IS TOO LONG*.

Like... lemme just add a break if it looks better, will you?

But it is the style at this time, so we shall tie an onion to our
belt.
2020-06-24 20:43:56 +02:00
Fabian Homborg
d0c1f2a2cc Remove duplicated line
Oops.
2020-06-24 18:33:26 +02:00
Fabian Homborg
3d2dc856ab Disable the SUSP character
This makes binding \cz possible.

We already ignore the SIGTSTP signal it sends, so until now it was useless.

(also STOP and START for good measure, but since we disable flow
control in fish anyway these already shouldn't have been sent)

Fixes #7152
2020-06-24 18:26:17 +02:00
Mahmoud Al-Qudsi
8b910d6de2 Further optimize performance of terminal output
Profiling shows that parsing color names still took much longer than it
should.

wcscasecmp is so slow that using it directly causes `try_parse_special`
to consume up to 3% of all of fish's cpu time due to extremely
inefficient invariant case lookups for wide characters (tested: Fedora
Server 32 w/ glibc 2.31 with -O2).
2020-06-22 23:39:51 -05:00
Mahmoud Al-Qudsi
3c90b6c57d Re-implement optimizations to color lookup by name
Hopefully without the null-termination issues this time around. Fixed by simply
cloning the str object as-is then transforming it.
2020-06-20 17:00:30 -05:00
Fabian Homborg
7447c8faae Also undo changes to ICRNL and INLCR
These control the disambiguation between ctrl-j and ctrl-m.

This can cause the enter key to send a ctrl-m, which programs might be
unprepared for.

(This is why you need to do `stty sane<ctrl-j>`)
2020-06-20 23:40:37 +02:00
Fabian Homborg
30eb4d8b0d Revert "Optimize lookup of colors by name"
Yeah, there's some weirdness here with ASAN that I can't reproduce locally, so we revert it for now.

This reverts commit a6efe0f0e4.
2020-06-20 22:35:14 +02:00
Fabian Homborg
40de4ef764 Color lookup: Use wcsncmp to avoid looking at garbage
The `reserve` here can, under certain circumstances, reserve more than
strictly needed.

The simple workaround is to just never look at more than we feed in.

(really what we'd *want* is to look at the length of the *color
names*, but those are wchar, so length lookup is crappy NULL-lookup)
2020-06-20 22:13:54 +02:00
Mahmoud Al-Qudsi
a6efe0f0e4 Optimize lookup of colors by name
This was profiled to be a hotspot during startup. The usage of
wcscasecmp in a loop caused repeated transforms to lowercase, which is
incredibly slow for wide characters.
2020-06-20 13:57:24 -05:00
Mahmoud Al-Qudsi
f2d5f95396 Merge sigint_checker_t generalizations from #7060
This makes it possible to expand the signals checked by the type. I can't merge
the sigttin fixes for #7060 yet because they introduce new breakage, but this
will make merging any future fix easier.
2020-06-20 11:27:15 -05:00
Fabian Homborg
e9e23a8333 Force some terminal modes even for external commands
In #7133, neovim crashing caused "OPOST" to be turned off, which
caused a weird staircase display.

So we just force a set of settings that don't seem useful to change to
avoid breaking the terminal with something like that.

Fixes #7133.
2020-06-19 21:09:08 +02:00
Fabian Homborg
a121833e88 argparse: Only print stacktrace when it's an error in argparse usage
A broken/missing optspec or `--` is a bug in the script using
argparse, an unknown option or invalid argument is a bug in using that script.

So in the former case print a stacktrace, because the person writing
the `argparse` call is at fault, in the latter don't.

Fixes #6703.
2020-06-17 20:05:48 +02:00
ridiculousfish
e91a06b764 Correct a misspeeling 2020-06-09 19:57:04 -07:00
ridiculousfish
269f907f2f Use inline ivar initialization in parse_node_t 2020-06-09 15:16:31 -07:00
ridiculousfish
19293ec2d6 Make parse_keyword_t an enum class 2020-06-09 15:13:02 -07:00
ridiculousfish
b4351c5927 Clean up posix_spawn code paths
Prior to this change, the posix_spawn code paths used a fair amount of
manual management around its allocated structures (attrs and file actions).
Encapsulate this into a new class that manages memory management and error
handling.
2020-06-09 14:59:06 -07:00
ridiculousfish
c7160d7cb4 Eliminate the termsize handling from common.h
Finish the transition to termsize.h. Remove the scary termsize bits
from common.cpp, which can throw off events at arbitrary calls and are
dangerously reentrant. Migrate everyone to the new termsize.h.
2020-06-07 20:00:42 -07:00
ridiculousfish
6bdbe732e4 Adopt termsize_t in the pager 2020-06-07 20:00:42 -07:00
ridiculousfish
db909605b8 Migrate reformat_for_screen to new termsize container 2020-06-07 20:00:42 -07:00
ridiculousfish
340c8490f6 Introduce termsize_container_t
fish's handling of terminal sizes is currently rather twisted. The
essential problem is that the terminal size may change at any point from a
SIGWINCH, and common_get_{width,height} may modify it and post variable
change events from arbitrary locations.

Tighten up the semantics. Assign responsibility for managing the tty size
to a new class, `termsize_container_t`. Rationalize locking and reentrancy.

Explicitly nail down the relationship between $COLUMNS/$LINES and the tty
size. The new semantics are: whatever changed most recently takes
precendence.
2020-06-07 20:00:42 -07:00
ridiculousfish
d5a239e59e Bravely stop attempting to modify the terminal size
Prior to this fix, fish would attempt to resize the terminal via
TIOCSWINSZ, which was added as part of #3740. In practice this probably
never did anything useful since generally only the tty master can use
this. Remove the support and note it in the changelog.
2020-06-07 20:00:42 -07:00
ridiculousfish
df618a0768 Migrate DFLT_TERM from common.h to env.cpp
There's no reason every .cpp file needs to see these values.
2020-06-07 20:00:41 -07:00
ridiculousfish
7b486b4634 Factor s_reset better
Prior to this fix, s_reset would attempt to reset the screen, optionally
using the PROMPT_SP hack to go to the next line. This in turn required
passing in the screen width even if it wasn't needed (because we were
not going to abandon the line). Factor this into two functions:

- s_reset_line which does not apply the hack
- s_reset_abandoning_line which applies the PROMPT_SP hack
2020-06-07 20:00:41 -07:00
ridiculousfish
fc42516dfb Unwind some calls to common_get_width from inside screen
common_get_width will "lazily" decide the screen width, which means
changing the environment variable stack. This is a surprising thing
to do from the middle of screen rendering.

Switch to passing in widths explicitly to screen.
2020-06-07 20:00:41 -07:00
ridiculousfish
0673d86242 Remove a dead overload of s_reset
This function was not actually implemented.
2020-06-07 20:00:41 -07:00
ridiculousfish
812cc1dbaf Clean up line_t
Use a single allocation instead of two for text and colors.
Comment and tighten up its methods.
2020-06-07 20:00:41 -07:00
ridiculousfish
5429b54258 Remove k_invalid_termsize 2020-06-07 20:00:41 -07:00
ridiculousfish
462313f930 Remove ASSERT_IS_NOT_FORKED_CHILD from open_cloexec
This was tripping initialization order checks from ASAN, and is
otherwise not a very useful check here.
2020-06-07 19:58:52 -07:00
Kristofer Rye
3cfe113a60 builtin_string: Remove redundant condition in handle_flag_f
The removed comparison ({begin,end,field} == INT_MIN) always evaluates
to false, because at this point in evaluation, `begin <= 0` has already
been evaluated to be false.  Since INT_MIN <= 0, the second conditional
in all three of the affected cases is always false.  The C++ standard
seems to guarantee left-to-right evaluation of logical operators, but
not necessarily bitwise operators.

Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
2020-06-07 15:56:51 -07:00
ridiculousfish
229ead9b8a env_stack_t::set_termsize to operate on self, not global stack 2020-06-07 12:57:34 -07:00
ridiculousfish
064324984b Use consistent variable names in decl and def of calc_prompt_layout 2020-06-07 12:56:14 -07:00
Rosen Penev
9636d9f5d3 [clang-tidy] remove pointless string init
Found with readability-redundant-string-init

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-07 12:49:35 -07:00
Rosen Penev
67e5473a11 [clang-tidy] remove pointless cstr
Found with readability-convert-member-functions-to-static

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-07 12:49:35 -07:00
Rosen Penev
871a15bf58 [clang-tidy] fix automatic move warning
Found with performance-no-automatic-move

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-07 12:49:35 -07:00
Fabian Homborg
1b4378d39d test: Show indexes starting at 1
We are 1-indexed, and so it's weird to have `test` count its arguments
from 0.

For `test 1 =` this changes the error from

test: Missing argument at index 2
1 =
    ^

to

test: Missing argument at index 3
1 =
    ^
2020-06-07 16:23:24 +02:00
Fabian Homborg
8a9e038b4e test: Show a caret for errors
test loves error messages like

test: Missing argument at index 2

without explaining where that "index 2" is.

So now, we print the arguments below that, with a caret pointing to
the place where the error occured.

For example:

    > test 1 = 2 and echo true or echo false
    test: Expected a combining operator like '-a' at index 3
    1 = 2 and echo true or echo false
          ^

    (Type 'help test' for related documentation)

Fixes #6030.
2020-06-07 16:23:10 +02:00
ridiculousfish
61e948454f Do even less work for empty commands
Inspired by #4829, skip further work when running a command
interactively if that command is empty.
2020-06-06 17:17:22 -07:00
Awal Garg
cb5eb72c6b Skip pre/post exec events for empty commands (#4829) 2020-06-06 16:31:33 -07:00
Fabian Homborg
44184f68e4 Add status dirname and status basename convenience commands
There's a terrible number of fishscripts that start with

    set path (dirname (status filename))

And that's really just a bit boring.

So let's let it be

    set path (status dirname)
2020-06-04 18:23:32 +02:00
Kristofer Rye
146ec619d9 Add "alacritty" to the list of known titleable TERMs
This change is necessary to fix dynamic titles for the Alacritty
terminal.  We do this by simply adding the (wchar_t *) literal
L"alacritty" to the end of the title_terms array.  This variable is
ultimately used in the subsequent function
does_term_support_setting_title (dtsst) for the purposes of whitelisting
certain terminals.

If an Alacritty user does not have the terminfo for alacritty present in
their terminfo database, Alacritty sets the TERM variable to
"xterm-256color", but if the terminfo for Alacritty is present, TERM is
instead set to "alacritty".

Prior to this change, none of the "fallback patterns" in the dtsst
function (which is used to ultimately decide whether or not a given
value of the TERM environment variable is supported) would apply to a
value of "alacritty".  Ordinarily, the dtsst function would return true
if nothing matches, but one of the final checks involves testing the
result of ttyname_r to see if it contains the substring "tty", which
causes dtsst to return false.  In the case where TERM="alacritty", this
is erroneous, because Alacritty does, indeed, support changing its title
and will also silently ignore attempts to change the title if that
behavior has been disabled by the user [1].

The changed file, src/env_dispatch.cpp, was reformatted by clang-format
in accordance with the documented procedures for contributors.

Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>

[1]: 1dacc99183/alacritty_terminal/src/term/mod.rs (L896-L900)
2020-06-01 19:06:32 -07:00
Fabian Homborg
4d487f711d Don't use cbegin/cend
This has problems on old gcc, and isn't super necessary.
2020-06-01 15:52:15 +02:00
Fabian Homborg
90b01fd915 set: Show pathvariableness in --show 2020-06-01 15:51:10 +02:00
John Zhang
8096d10bf1 remove redundant if conditions
All pcre2 resource free functions handle null pointer gracefully.
2020-05-31 17:10:09 -07:00
ridiculousfish
3ae91f197d Remove SIGTTOU handler before restoring foreground process group
When fish exits, it tries to restore the foreground process group.
However this may actually steal control of the fg process group
from another process. Fix this by clearing the SIGTTOU handler so
that tcsetpgrp() will fail.

Credit to @mqudsi for awesome debugging.

Fixes #7060
2020-05-31 14:11:39 -07:00
ridiculousfish
03208acb60 Don't call redirect_tty_output when restoring the front process group
redirect_tty_output was a clumsy attempt to work around a glibc bug, but
it's not necessary if fish is about to exit.
2020-05-31 13:51:47 -07:00
ridiculousfish
a2ae2d6c36 Attempt to truncate prompts that are too wide
Prior to this change, if the user's prompt was wider than the terminal, we
would reduce it to just `> `. With this change, attempt to truncate the
prompt.

For each line of the prompt, calculate its width. If the width exceeds
COLUMNS, prepend ellipsis to that line, and start removing characters
until it fits. Escape sequences are skipped.

Fixes #904
2020-05-31 09:58:47 -07:00
ridiculousfish
67a4b35838 Migrate cached_layouts into layout_cache_t 2020-05-30 15:00:28 -07:00
ridiculousfish
7cc99a2d80 Rename job_tree to job_group
Initially I wanted to pick a different name to avoid confusion with
process groups, but really job trees *are* process groups. So name them
to reflect that fact.

Also rename "placeholder" to "internal" which is clearer.
2020-05-30 14:22:44 -07:00
ridiculousfish
b119c4b3bb Eliminate pgroup_provenance_t
Now that job trees are a single source of truth for a job's pgid, we no
longer need fancy logic around how the pgroup is assigned.
2020-05-30 14:22:44 -07:00
ridiculousfish
f37a44db16 Migrate job pgid from job to job tree
Prior to this, jobs all had a pgid, and fish has to work hard to ensure
that pgids were inherited properly for nested jobs. But now the job tree
is the source of truth and there is only one location for the pgid.
2020-05-30 14:22:44 -07:00
ridiculousfish
a86d3f4136 Remove job_lineage_t
Its responsibilities are now subsumed by job_tree_t except for
the block_io which we pass around explicitly.
2020-05-30 14:22:44 -07:00
ridiculousfish
55db918d59 Start to unwind lineages
job_lineage was used to track "where jobs came from" but the job tree idea is
a better abstraction. It groups jobs together similar to how a process group
would in other shells. Begin to remove the notion of lineage.
2020-05-30 14:22:44 -07:00
ridiculousfish
a4b66d948b Add a property describing when a job is initially backgrounded
Track separately whether a job is in the background now, and whether
it was constructed in the background via the & syntax.
2020-05-30 14:22:44 -07:00
ridiculousfish
123f3e6f93 Put job_id into job_tree
Job IDs are really a property of a job tree, not individual jobs. Reflect
that fact by migrating job IDs into job_tree.
2020-05-30 14:22:44 -07:00
ridiculousfish
fe60f2ef16 Move root_has_job_control from lineage to job_tree
Whether we have job control is a property of the job tree, not of
individual jobs. Reflect that fact directly by moving it into the job tree.
2020-05-30 14:22:43 -07:00
ridiculousfish
e95bcfb074 Teach a job to decide its job tree
Job trees come in two flavors: “placeholders” for jobs which are only fish
functions, and non-placeholders which need to track a pgid. This adds
logic to allow a job to decide if its parent's job tree is appropriate,
and allocating a new tree if not.
2020-05-30 14:22:43 -07:00
ridiculousfish
4e01c06256 Introduce job_tree
job_tree represents the data that should be shared between a job and any
jobs that may be spawned by functions or eval run as part of that job. It
reifies shared data that before was handled piecemeal.
2020-05-30 14:22:43 -07:00
Mahmoud Al-Qudsi
7e61205294 Make sure p->last_jiffies doesn't change after sanity checking
See 821525e503 and #7066
2020-05-30 16:05:29 -05:00
Mahmoud Al-Qudsi
821525e503 Defend against race condition calculating job cpu usage
Closes #7066
2020-05-30 16:00:34 -05:00
Mahmoud Al-Qudsi
f4ae69a905 fixup! Recover from bad redirections in the middle of a job pipeline
Fix inadvertent early abort (thanks, nested switch-in-for-loop!) that
led to subsequent shell input being broken.
2020-05-30 10:37:46 -05:00
Mahmoud Al-Qudsi
bc756a981e Recover from bad redirections in the middle of a job pipeline
Currently fish aborts execution mid-pipeline if a file redirection
failed, which can leave the shell in a broken state (job abandoned after
giving control of the terminal to an already-executed job in the
pipeline).

This patch replaces a failed fd with a closed fd and continues execution
if the affected process wasn't the first in the pipeline.

While this is a hack to address the regression behind fish-shell/#7038
introduced in d62576c, it can also be argued that this behavior is
actually more correct... right?

Closes #7038.
2020-05-30 00:27:11 -05:00
Fabian Homborg
4785440f65
Add an "_" builtin to call into gettext (#7036)
* Add an "_" builtin to call into gettext

We already have gettext in C++ (if available), so it seems weird to
fork off a command to start it from script.

This is only for fish's own translations. There's no way to call into
other catalogs, it just translates all arguments separately.

This is faster by a factor of ~1000, which allows us to call
translations much more, especially from scripts.

E.g. making fish_greeting global by default would hurt cost-wise,
given that my fish starts up in 8ms and just calling the current `_`
function takes 2ms, and that would have two calls.

Incidentally, this also makes us rely on a weirdly defined function
less, so it:
Fixes #6804.

* docs: Add `_` docs

Let's see if that filename works out.

* Reword _ docs
2020-05-29 20:53:44 +02:00
Fabian Homborg
7cb452c7e7 Computed variables are global
Variables like $status and $history showed up in all scopes, including
universal, when querying with `set -q` or `set -S`.

This makes it so they all only count as set in global scope, because
we already only allow assignment to electric variables in global scope.

Fixes #7032
2020-05-27 19:59:20 +02:00
Joel Kuhn
6853705b0b Fix underflow in commandline jump functions
This patch fixes an underflow in the jump family of readline commands
when called via `commandline -f` outside of a bind context such as
`commandline -f backward-jump`. To reproduce, run that command at a
prompt and the shell will crash with a buffer underlow.

This happens because the jump commands have non-zero arity, requiring a
character event to be pushed on the function args stack. Pushing the
character event is handled in `function_push_args`, called by
`inputter_t::mapping_execute`, which checks the arity of the function
and enqueues the required number of charcter events. However,
`builtin_commandline` calls `reader_queue_ch`, which in turn calls
`inputter_t::queue_ch`, which immediately enqueues the readline event
without calling `function_push_args`, so the character event is never
pushed on the arg stack.

This patch adds a check in inputter_t::queue_ch which checks if the
character event is a readline event, and if so, calls
`function_push_args`.
2020-05-26 19:53:09 -07:00
Mahmoud Al-Qudsi
2d52335fed Don't fire fish_prompt when read is used
Apart from being semantically incorrect, this was causing `fish_prompt`
to fire twice after commands that used `read` (e.g. `cdh`).

Closes #7039.
2020-05-26 15:24:31 -05:00
ksralgp
f55f98b064
Show autosuggestions when (left prompt + command) exceed right prompt (#7035)
* Show autosuggestions when (left prompt + command) exceed right prompt

* Fix indentation whitespace and run build_tools/fish.style on src/screen.cpp
2020-05-24 21:54:00 +02:00
ridiculousfish
84e0c8d32e Guard thread_local
Mac OS X 10.9 supports __thread but not C++11 thread_local.
Teach CMake to detect support for thread_local and use the proper
define guard.

Fixes #7023
2020-05-22 13:41:05 -07:00
ridiculousfish
1fd0cd5510 Avoid forming owning_lock of incomplete type in history
Older libstdc++ will error on this.

Partially addresses #7023
2020-05-22 13:36:46 -07:00
Johannes Altmanninger
285861d346 Do notify about jobs that were continued outside fish
When sending SIGCONT to a stopped job, this behaves now
a bit more like a job that was continued by the bg builtin;
bg uses job_t::continue_job which seems overkill here.
2020-05-22 21:28:54 +02:00
Fabian Homborg
e51f4e5fc9 Don't print a warning about tcgetattr if stdin is not a tty
I don't know why this doesn't happen more often, but if stdin is not a
tty not being able to get terminal attributes from it is *expected*?
2020-05-21 10:31:32 +02:00
Fabian Homborg
3af715d36f test_helper: Limit signal numbers more
This just produced a spurious "Unknown signal" error on NetBSD and OpenBSD, and
the number picked was arbitrary. So let's just use the maximum that
appears to work everywhere.

(I will hate this if I test it elsewhere and need to reduce it to 62)

(This is a squashed commit, I did indeed hate it when I moved from
NetBSD to OpenBSD)
2020-05-21 10:30:54 +02:00
Johannes Altmanninger
91ccaae5bf fish_indent: fix error message on ENOENT 2020-05-19 21:15:11 +02:00
Charles Gould
a0faac400d Print warning on failure to match debug category 2020-05-19 21:07:33 +02:00
Charles Gould
a7aca37f9b Print enabled debug categories 2020-05-19 21:07:33 +02:00
Soumya
518170b299 Also call fish_job_summary for foreground sigint
The default implementation will not print any output in that case, but this provides users with additional flexibility when it comes to customising the shell's behaviour.
2020-05-19 20:39:10 +02:00
Soumya
324fa64114 Add fish_job_summary, called whenever a job ends, stops, or is signalled
This allows users to customise the behaviour of the shell by redefining the function. This is similar to how fish_title or fish_greeting behave, where the default implementation can be easily overridden.

The function receives as arguments the job id, command line, signal name and signal description.
2020-05-19 20:39:10 +02:00
Fabian Homborg
56f24f08d7 printf: Don't print an error if not given an argument 2020-05-18 20:48:36 +02:00
Fabian Homborg
29754f3540 Keep terminal modes for external commands
This allows tools like `stty` to set the terminal modes and fish will
honor them, for external commands.

The modes for fish are kept as they are.

Until now, the only change fish would do to the external modes is to
disable flow control *every time*, this changes it to only disabling
it on startup.

After that we don't apply *any* changes to the external modes (no
checks or validation or...), because we've never done that (other than
flow control), and it's not been a problem.

Fixes #2315.
2020-05-16 13:04:51 +02:00
Johannes Altmanninger
e03c375ee3 Purge remnants of process expansion, document {fish,last}_pid 2020-05-16 11:58:12 +02:00
Johannes Altmanninger
83c657c010 Fix IO error handling in non-interactive reader
This used to use fread(2) which returns size_t, but read(2) returns
an ssize_t of -1 on error.

Fixes #6990
2020-05-10 22:33:22 +02:00
David Adam
6bd563ca32 history: use mode 0600 for creating history file
Fixes #6926.
2020-05-10 21:28:16 +08:00
Johannes Altmanninger
5cd7c3a30b Teach builtin functions about -t for --handlers-type
Fixes #6985
2020-05-08 22:47:40 +02:00
David Adam
c2942a70d6 common.h: drop some unused macros
Last use removed in 81ded4c0ab.
2020-05-08 22:17:26 +08:00
Fabian Homborg
81ded4c0ab Don't default term size if it is too small
This is unlikely to achieve anything sensible.

Fixes #6980.
2020-05-07 17:42:02 +02:00
Charles Gould
ad020e84dd Exit key reader normally on help, version 2020-05-05 12:33:22 +08:00
ridiculousfish
aa8c9df2d0 Stop copying a string in hash<const wcstring> 2020-05-01 13:30:56 -07:00
Rosen Penev
0668513138 Change C casts to C++ ones
Some were kept for compatibility.

Found with -Wold-style-cast

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-01 13:30:56 -07:00
ridiculousfish
4116829292 Do not issue clr_eos if we think the cursor will end up on its own line
If we output text and end up in the last column, the sticky right edge
will cause a clr_eos to erase the last character. Ensure this doesn't
happen by not issuing clr_eos in that case.

Fixes #6951
2020-04-29 14:22:54 -07:00
ridiculousfish
8c4c9d050d Clear cancellation signals after handling a readline command
If a readline command is bound to a key sequence which also sends a
signal, then fish will set the cancel flag in addition to handling the
command. But this cancel flag is then persistent. Ensure it gets cleared
after each command.

Fixes #6937
2020-04-29 13:38:15 -07:00
David Adam
8d43439640 wutil: add SMB2 file type to fd_check_is_remote
The manual page for statfs(2) only lists SMB_SUPER_MAGIC and
CIFS_MAGIC_NUMBER, but it turns out there's a third type of CIFS/SMB
mount, represented by SMB2_MAGIC_NUMBER.

Haunting me from #6609.
2020-04-29 23:34:13 +08:00
ridiculousfish
2951c05934 Do not consider dumb terminals to have wrapping
For the purpose of cursor_is_wrapped_to_own_line, always return false
for dumb terminals. Fixes the tests.
2020-04-28 16:30:52 -07:00
ridiculousfish
4f103d74fb Do not emit newline when running commands if the cursor is on its own line
If the cursor has been wrapped to the last line, and is the only thing
on that line, do not emit a newline when executing a command.

Fixes #6826
2020-04-28 11:51:46 -07:00