Commit Graph

85 Commits

Author SHA1 Message Date
ridiculousfish
a3dbca90d5 g++-friendly 'Rework iothread_perform for void return types'
Allows iothread_perform to work with void return types on both
g++ and clang

This reverts commit 1040b255c7
and reintroduces ac9a0f0dbf
2017-01-26 09:40:17 -08:00
Kurtis Rader
a447a9aeff correct handling of SIGHUP by interactive fish
This is a partial fix for issue #3737. It only addresses the SIGHUP
aspect of the problem. Fixing SIGTERM is TBD.
2017-01-24 15:24:13 -08:00
Kurtis Rader
64485167e9 Revert "correct handling of SIGHUP by interactive fish"
This reverts commit 31adc221d9.
2017-01-24 07:34:15 -08:00
Kurtis Rader
31adc221d9 correct handling of SIGHUP by interactive fish
This is a partial fix for issue #3737. It only addresses the SIGHUP
aspect of the problem. Fixing SIGTERM is TBD.
2017-01-23 19:42:27 -08:00
ridiculousfish
439f233ccc Make fire_event_callback take a std::function instead of function pointer 2017-01-21 17:15:45 -08:00
ridiculousfish
bb65b82c56 Mark some signal-related variables as 'volatile sig_atomic_t' 2017-01-21 13:33:46 -08:00
Kurtis Rader
2be1288cac handling when stty reports zero for termsize
If the kernel reports a size of zero for the rows or columns (i.e., what
`stty -a` reports) fall back to the `COLUMNS` and `LINES` variables. If
the resulting values are not reasonable fallback to using 80x24.

Fixes #3740
2017-01-20 15:34:29 -08:00
Kurtis Rader
d6ceeb915d fix interaction of buffered/unbuffered output
Fixes #3747
2017-01-19 20:58:12 -08:00
Kurtis Rader
56e05dab02 another attempt to workaround a glibc bug
This is another attempt to fix issue #3644 that we believe is due to issue
https://sourceware.org/bugzilla/show_bug.cgi?id=20632.
2017-01-13 21:18:34 -08:00
Kurtis Rader
11dccccdcc optimize determining if can set term title
Decide if the terminal supports setting its title only when necessary
(e.g., when TERM changes) rather than everytime we're about to write
the prompt.
2017-01-10 13:11:39 -08:00
Kurtis Rader
e9de674bbd handle ttyname returning NULL
If the tty has been closed (i.e., become invalid) the `ttyname()`
function will return NULL. Passing that NULL to `strstr()` can crash
fish which means it won't kill its child processes and exit cleanly.

Another fix for #3644
2017-01-10 13:11:39 -08:00
Kurtis Rader
573916e5e2 ensure CMD_DURATION can be used in prompts
A third-party plugin noticed that using `$CMD_DURATION` in the prompt
causes problems when combined with the recent changes to tighten up
parsing of strings meant to be integer values. This fixes the problem by
ensuring the var is defined before the first interactive command is run.

See https://github.com/fisherman/dartfish/issues/7
2017-01-06 21:14:29 -08:00
Kurtis Rader
f0515d0caa improve wording of error message
Zanchey proposed this improved wording in feedback to PR #3658.
2017-01-05 12:09:29 -08:00
Kurtis Rader
b118ed69d3 convert narrow stderr output to wide forms
On some platforms, notably GNU libc, you cannot mix narrow and wide
stdio functions on a stream like stdout or stderr. Doing so will drop
the output of one or the other. This change makes all output to the
stderr stream consistently use the wide forms.

This change also converts some fprintf(stderr,...) calls to debug()
calls where appropriate.

Fixes #3692
2017-01-03 16:14:42 -08:00
Dale Eidd
7b906134e2 Fix commandline selection including extra character
Fixes #3684
2017-01-01 13:57:31 -08:00
Kurtis Rader
1621fa43d8 don't mix narrow and wide stdio
Fixes #3686
2016-12-29 12:24:56 -08:00
Kurtis Rader
7c40abe4a6 switch from \1xb to \e in the code
Using `\e` is clearer and shorter than `\x1b`. It's also consistent with how
we write related control chars; e.g., we don't write `\x0a` we write '\n'.
2016-12-24 12:15:28 -08:00
Kurtis Rader
01dbfb0a3f replace writestr() with fwprintf() in reader.cpp
There are several places that use writestr() which should instead be
using fwprintf() or equivalent. Also, clarify the documentation for why
writestr() and writechr() exist so they aren't used inappropriately
again.

Fixes #3657
2016-12-23 19:24:44 -08:00
ridiculousfish
3b50fe8b68 Correct a comment
We now kill all jobs, not just background jobs
2016-12-20 15:49:55 -08:00
Kurtis Rader
9870cf838a fix exiting breakpoint interactive context
Commit 8d27f81a to change how background jobs are handled (killed rather
than left running) when the shell is exited did not correctly handle
the nested interactive context created by the `breakpoint` command. This
fixes that mistake. Now any background jobs that already existed, or were
created within the `breakpoint` context, are left running when exiting
that context.
2016-12-19 20:35:57 -08:00
Kurtis Rader
8d27f81a7b kill all jobs when exiting an interactive shell
Fish is not consistent with other shells like bash and zsh when exiting
an interactive shell with background jobs. While it is true that fish
explicitly claims no compatibility with POSIX 1003.1 this is an area
where deviation from the established practice adds negative value.

The reason for the current behavior seems to be due to two users who did
not understand why interactive shells managed background jobs as they
did and were not aware of tools like `nohup` or `disown`. See issue

There is also a fairly significant bug present due to a misunderstanding of
what a true value from `reader_exit_forced()` means. This change corrects
that misunderstanding.

Fixes #3497
2016-12-19 18:55:52 -08:00
Kurtis Rader
396bf1235d workaround glibc bug that can corrupt malloc arena
If an interactive shell has its tty invalidated attempts to write to
stdout or stderr can trigger this bug:

https://sourceware.org/bugzilla/show_bug.cgi?id=20632

Avoid that by reopening the stdio streams on /dev/null if we're getting
an ENOTTY error when trying to do things like give or take ownership of
the tty.

This includes some unrelated style cleanups but including them seems
reasonable.

Fixes #3644
2016-12-14 20:12:37 -08:00
Michael Steinert
e2ed561264 Fixes behavior of 'x' in normal mode
After 'x' is used to delete a character at the end of a line the cursor
should be repositioned at the last character, i.e. repeatedly pressing
'x' in normal mode should delete the entire string.
2016-12-01 16:23:59 -08:00
Aaron Gyes
13a4ef80b3 Nuke spurious newline of shell exit.
Nobody has any idea why it's here, and it is mildy annoying to some
users, so let's remove it. Fixes #3502
2016-11-19 16:00:54 -08:00
ridiculousfish
0de2a1072f Fix a pair of implicit conversion warnings 2016-11-19 15:45:08 -08:00
Kurtis Rader
83c7931afb treat TERM "tmux" the same as "screen"
To the extent that fish special-cases TERM values relevant to the
`screen` program it should do the same for the `tmux` program.

Fixes #3512
2016-11-06 20:27:48 -08:00
Kurtis Rader
b7d910a941 lint: long variable name 2016-11-03 16:19:41 -07:00
Kurtis Rader
f05fe4e292 lint: problems with default in switch statements 2016-11-03 16:19:41 -07:00
Kurtis Rader
9b0d45d4fa lint: unnecessary else statement 2016-11-02 14:44:27 -07:00
Kurtis Rader
5709c81fe0 lint: empty while statement 2016-11-02 14:22:34 -07:00
Kurtis Rader
71e69b6d75 lint: empty if statement 2016-11-01 20:42:02 -07:00
Kurtis Rader
7779132595 lint: Use early exit/continue 2016-10-31 17:58:41 -07:00
Kurtis Rader
f382fa8e8a lint: multiple unary operator 2016-10-27 21:21:54 -07:00
Kurtis Rader
cdb82e45ac lint: remove another "too few branches in switch statement" 2016-10-22 22:12:22 -07:00
Kurtis Rader
21521b2953 lint: too few branches in switch statement
Someone was way too enamored of the `switch` statement. Using it in
places where a simple `if...else if...else` was clearer and shorter.
2016-10-22 21:01:27 -07:00
Kurtis Rader
42458ff7ab lint: "collapsible if statements" warnings 2016-10-22 19:09:40 -07:00
Kurtis Rader
6e6b294a3f lint: deal with "double negative" warnings 2016-10-20 21:14:40 -07:00
Kurtis Rader
00303ed07f lint cleanup: parameter reassignment 2016-10-20 18:53:31 -07:00
Kurtis Rader
8a2d6a9752 fix/unify tests for chars in fish reserved ranges 2016-10-17 18:46:53 -07:00
Kurtis Rader
c07c98ac05 eliminate many "unused parameter" warnings
Partially addresses issue #3430.
2016-10-09 14:38:26 -07:00
Kurtis Rader
851e449347 eliminate signed/unsigned comparison warnings
This partially addresses #3430.
2016-10-09 14:36:08 -07:00
Kurtis Rader
f3e93f0666 fix handling input in the C locale
In the C/POSIX locale EOF on the tty wasn't handled correctly due to a change
a few months ago to fix an unrelated problem with that locale. What is
surprising is that the core fish code doesn't explicitly depend on
input_common_readch returning WEOF if a character isn't seen within
`wait_on_escape_ms` after an escape.

Fixes #3214
2016-08-12 20:33:43 -07:00
Kurtis Rader
710addde16 fix history --delete regression
The recent change to reconcile the history builtin command and function
broke an undocumented behavior of `history --delete`. This change
reinstates that behavior. It also adds an explicit `--exact` search mode
for the `--search` and `--delete` subcommands.

Fixes #3270
2016-08-10 21:51:01 -07:00
ridiculousfish
ba12bcad33 Correctly set the generation count for background highlighting threads
Fixes #2789
2016-07-09 16:13:40 -07:00
Aaron Gyes
0d6bdb38e6 Style fixes. 2016-06-23 22:48:45 -07:00
Aaron Gyes
9f0c31611c Lint Cleanup
This remove some stores that clang assures me are very dead.

And an assert() for an unlikely NULL pointer dereference I can't quite
figure out.
2016-06-14 19:27:00 -07:00
Aaron Gyes
1499ade89c Restyle touched .cpp files 2016-06-12 11:34:35 -07:00
Aaron Gyes
1357f5a364 Repair various invalid HeaderDoc comments.
Enable build setting to allow Xcode to complain about invalid
comments.
2016-06-05 18:57:45 -07:00
Fabian Homborg
57f289850c Don't insert prefix for non-prefix matches
The issue here is that when inserting a common prefix for e.g. a
substring match, we increase the amount of available candidates again to
things the user didn't want.

An example is in share/functions - a completion for "inter" would
previously expand to "__fish_" because it matched:

- __fish_config_interactive.fish
- __fish_print_interfaces.fish
- __fish_print_lpr_printers.fish

The completion afterwards would then show 189 possible matches, only
three of which (the above) actually matched the original "inter".

Fixes #3089.
2016-06-02 21:25:50 -07:00
Fabian Homborg
ffcfe73299 Allow suggestion when selecting in pager
Also mentioned in #3016.
2016-05-27 15:02:56 -07:00