ridiculousfish
7e1270ae70
Be more disciplined about cancellation signals
...
Rather than storing a "should cancel" flag in the parser, store the
actual signal which triggered cancellation.
2020-01-14 15:20:04 -08:00
Fabian Homborg
31e6ae0099
Ignore EPERM for setpgid
...
In case we are a session leader, we get a harmless EPERM, yet we used
to quit. Stop doing that.
Fixes #6499 .
2020-01-13 18:57:19 +01:00
Rosen Penev
b1349f44f6
[clang-tidy] Add const to reference
...
Found with performance-unnecessary-copy-initialization
2019-12-26 21:37:15 -08:00
Rosen Penev
2ecc386121
[clang-tidy] Remove redundant c_str
...
Found with readability-redundant-string-cstr
2019-12-26 21:25:07 -08:00
Fabian Homborg
e986970f4d
Remove vi_arg_digit and vi_delete_to
...
They don't do anything anymore.
2019-12-25 10:44:27 +01:00
Mathieu Duponchelle
15c1b3ed4b
Place fish in its own process group when launched with -i
...
Fixes #5909
2019-12-23 10:32:37 +01:00
ridiculousfish
c19407ab0f
Default parser_t::eval()'s block type to top
...
This is the parameter value at every call site except one. Just make it the
default.
2019-12-22 16:27:03 -08:00
ridiculousfish
a59f35a378
Make block_type_t an enum class
2019-12-22 15:37:14 -08:00
ridiculousfish
4529e7d183
Reverse the order of the block stack
...
Previously, the block stack was a true stack. However in most cases, you
want to traverse the stack from the topmost frame down. This is awkward
to do with range-based for loops.
Switch it to pushing new blocks to the front of the block list.
This simplifies some traversals.
2019-12-22 15:07:41 -08:00
Rosen Penev
7d1cc992e5
[clang-tidy] Simplify boolean expressions
...
Found with readability-simplify-boolean-expr
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-29 23:46:51 -08:00
Rosen Penev
4087b2ee15
[clang-tidy] Use bool literals
...
Found with modernize-use-bool-literals
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-29 23:46:50 -08:00
Rosen Penev
69d0bb7c0d
io.h: Add missing override
...
Found with clang's -Winconsistent-missing-destructor-override
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:50:40 -08:00
Rosen Penev
586ac3dfa7
[clang-tidy] Convert loops to range based
...
Found with modernize-loop-convert
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:50:40 -08:00
Rosen Penev
1055ff321c
[clang-tidy] Replace NULL with nullptr
...
Found with modernize-use-nullptr
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:23:03 -08:00
Rosen Penev
0dfa7421f3
[clang-tidy] Convert C casts to C++ ones
...
Found with google-readability-casting
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:17:49 -08:00
Rosen Penev
7f62e30731
[clang-tidy] Replace size comparisons with empty
...
Found with readability-container-size-empty
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:13:33 -08:00
Jason
3cf6ebc0e1
Amend typos and grammar errors
2019-11-25 13:07:15 +01:00
Ray Hogenson
98a98b1424
Change vi selection mode to be inclusive
...
The current cursor position should be included in the selection to be
consistent with the behavior of vi.
Fixes #5770
2019-11-19 20:25:10 +01:00
ridiculousfish
52e900690b
Make history_search_type_t an enum class
2019-11-02 18:56:16 -07:00
ridiculousfish
a7f1d2c0c7
Add support for fish_trace variable to trace execution
...
This adds support for `fish_trace`, a new variable intended to serve the
same purpose as `set -x` as in bash. Setting this variable to anything
non-empty causes execution to be traced. In the future we may give more
specific meaning to the value of the variable.
The user's prompt is not traced unless you run it explicitly. Events are
also not traced because it is noisy; however autoloading is.
Fixes #3427
2019-11-02 14:40:57 -07:00
Johannes Altmanninger
6702c84d15
Prevent buffer overflow when custom completions edit the commandline
...
This was introduced in a7ea7648c3
"Completion: maintain cursor position when there is no completion"
2019-11-01 13:21:49 +01:00
Aaron Gyes
d1970c7f2e
read_ni: be more specific in error if a file can't be read
...
for example, `fish /etc` now tells us "Is a directory"
make a couple char constants wchar_t constants
2019-10-14 01:43:35 -07:00
Aaron Gyes
5d84d3fe48
reader.cpp: remove unused pointer in read_ni
...
literally prehistoric in git blame
2019-10-14 00:42:03 -07:00
ridiculousfish
1a65e18ba8
Clean up some tokenization
...
Remove TOK_NONE
Turn token_type into an enum class
Make next() turn a maybe_t<tok_t> instead of a bool
2019-10-13 16:06:16 -07:00
ridiculousfish
82eca4bc86
Run clang-format on all files
...
The main change here is to reorder headers.
2019-10-13 15:50:48 -07:00
Per Bothner
afb8f42f39
Emit omitted-newline string before fish_prompt event
...
See issue #6118 "omitted-newline string emitted after fish_prompt event"
2019-10-06 10:52:12 -07:00
domdom
76f4b65981
Add prefix history search
2019-10-05 11:27:32 -07:00
Johannes Altmanninger
bc533ad939
Fix completion inside command substitution inserting spurious quote
...
Reproducer: type `: (: ""`, move the cursor after the second colon and press tab.
2019-09-22 14:06:38 -07:00
ridiculousfish
1ecbe363d0
Correct an assertion message
2019-09-21 15:17:09 -07:00
ridiculousfish
3f7bc7232e
yank_POP -> yank_pop
2019-09-21 14:31:22 -07:00
ridiculousfish
3f2f44ce73
Introduce reader_test_should_cancel
...
This centralizes the logic around cancellation due to either sigint or a
stale threaded operation.
2019-09-21 13:07:55 -07:00
Johannes Altmanninger
a7ea7648c3
Completion: maintain cursor position when there is no completion
...
Previously, tab-completion would move the cursor to the end of the current token, even
if no completion is inserted. This commit defers moving the cursor until we insert a completion.
Fixes #4124
2019-09-21 12:50:52 -07:00
Johannes Altmanninger
e9e92178a9
completions: simplify prefix computation
2019-09-21 12:50:52 -07:00
Johannes Altmanninger
6c5c0a73eb
remove useless call, fix comment
2019-09-21 12:50:52 -07:00
David Adam
3ae12ac4d3
Revert "Escape separators (colon and equals) to improve completion"
...
This reverts commit f7dac82ed6
from pull
request #6059 .
As discussed in #6099 , this caused a regression in some completions (eg
dd).
2019-09-19 14:38:16 +08:00
Johannes Altmanninger
8baea8b157
Do not add a space after completion if one is already there
...
Example: type `cd --help --help`, move the cursor inside the first `--help` and press tab.
This used to add redundant spaces.
2019-09-18 14:02:24 -05:00
Johannes Altmanninger
f7dac82ed6
Escape separators (colon and equals) to improve completion
...
Fish completes parts of words split by the separators, so things like
`dd if=/dev/sd<TAB>` work.
This commit improves interactive completion if completion strings legitimately
contain '=' or ':'. Consider this example where completion will suggest
a🅰️ 1 and other files in the cwd in addition to a:1
touch a:1; complete -C'ls a:'
This behavior remains unchanged, but this commit allows to quote or escape
separators, so that e.g. `ls "a:<TAB>` and `ls a\:<TAB>` successfully complete
the filename.
This also makes the completion insert those escapes automatically unless
already quoted.
So `ls a<TAB>` will give `ls a\:1`.
Both changes match bash's behavior.
2019-09-02 14:27:21 -07:00
ridiculousfish
0dc5eaeb97
reader_expand_abbreviation_in_command to return maybe_t<wcstring>
2019-08-06 16:09:23 -07:00
ridiculousfish
95c97619c6
Use cbegin() in one place in reader
2019-07-31 14:23:41 -07:00
Fabian Homborg
8013686d17
delete-or-exit: Only exit if the commandline is empty
...
This exitted if the cursor was at the end of the line as well (i.e. if
delete-char failed). That's a bit too eager.
Also documentation, which should have already been included.
2019-07-03 11:48:38 +02:00
ridiculousfish
4a2c709fb1
Eliminate shell_is_interactive
...
We used to have a global notion of "is the shell interactive" but soon we
will want to have multiple independent execution threads, only some of
which may be interactive. Start tracking this data per-parser.
2019-06-29 11:28:26 -07:00
Fabian Homborg
d7a9bdf5c3
reader: Do the "delete" part for delete-or-exit
...
For some reason this is supposed to do a delete-*char*.
I was assuming the function was broken and it should delete the entire
line.
Fixes #5967 .
2019-06-26 22:53:19 +02:00
Fabian Homborg
d415350aaf
reader: Add delete-or-exit bind function
...
This is an important binding and should therefore be in C++.
2019-06-25 19:57:00 +02:00
Fabian Homborg
caedf01c00
Revert "Latch signal handlers"
...
This reverts commit 7ed1022cf4
.
Fixes #5962 .
2019-06-25 11:25:09 +02:00
ridiculousfish
5b5887ea99
Correct capitalization of complete_and_search
2019-06-16 14:38:27 -07:00
Mahmoud Al-Qudsi
c9a77bb474
Optimize history search reset checking
...
`history_search.active()` is an atomic read, whereas
`command_ends_history_search(..)` is a little bit heavier.
2019-06-08 21:07:32 -05:00
ridiculousfish
ff55249447
Make events per-parser
...
This makes the following changes:
1. Events in background threads are executed in those threads, instead of
being silently dropped
2. Blocked events are now per-parser instead of global
3. Events are posted in builtin_set instead of within the environment stack
The last one means that we no longer support event handlers for implicit
sets like (example) argv. Instead only the `set` builtin (and also `cd`)
post variable-change events.
Events from universal variable changes are still not fully rationalized.
2019-06-03 02:48:35 -07:00
ridiculousfish
671df14178
Thread a parser into inputter_t
2019-06-02 16:41:13 -07:00
ridiculousfish
a48dbf23b8
Instantize the character event queue
...
Wrap this stuff up in structs so it's no longer global.
2019-06-02 16:37:05 -07:00
Fabian Homborg
1259b32ecc
Mark some variables as unused
...
These triggered warnings.
2019-05-29 20:50:35 +02:00