Commit Graph

382 Commits

Author SHA1 Message Date
Kurtis Rader
3a08a24259 remove diagnostic no one likes 2016-07-28 16:15:58 -07:00
Kurtis Rader
375de96016 deal with missing argv
A user reported that fish was dying from a SIGSEGV when launched by the
sjterm terminal app. This was traced to a bug in sjterm passing an empty
argv array to the shell. Which, while technically legal, is very unusual
and a bad practice.

Fixes #3269
2016-07-27 16:38:18 -07:00
Kurtis Rader
10ae6d8b26 fix some style problems that have crept in 2016-07-21 19:36:32 -07:00
Aaron Gyes
2fa4bd8fd7 Add missing debug output for two cases. 2016-07-21 07:23:14 -07:00
Aaron Gyes
3468fbc605 Tighten up support_term256 logic. Add missing Apple_Terminal underscore
Add some debug output like there is for 24bit mode.

I see now there is no need to setup terminal here - we get called early
sometimes for colors to work in config.fish to work but that is not so fatal.
Just check cur_term and trust get called again soon.
2016-07-21 07:10:00 -07:00
Kurtis Rader
8140f74d75 simplify oclint error suppression for scoped_buffer_t 2016-07-20 22:43:48 -07:00
Kurtis Rader
1d2fff9686 simplify oclint error suppression for scoped_lock 2016-07-20 22:30:58 -07:00
Kurtis Rader
b53f42970c correct handling of history args
This fixes several problems with how the builtin `history` command handles
arguments. It now complains and refuses to do anything if the user specifies
incompatible actions (e.g., `--search` and `--clear`). It also fixes a
regression introduced by previous changes with regard to invocations that
don't explicitly specify `--search` or a search term.

Enhances the history man page to clarify the behavior of various options.

This change is already far larger than I like so unit tests will be added
in a separate commit.

Fixes #3224.

Note: This fixes only a couple problems with the interactive `history
--delete` command in the `history` function. The main problem will be
dealt with via issue #31.
2016-07-20 21:18:48 -07:00
Aaron Gyes
4fbc476b19 Make the SnowLeopard exception only apply to SL.
Check TERM_PROGRAM_VERSION. It's < 300.0 on 10.6.
2016-07-19 08:53:55 -07:00
Aaron Gyes
9aad3781fb Check max_colors with rest of checks in input.cpp.
... with a terminal set up.
2016-07-19 08:02:00 -07:00
Aaron Gyes
23ea77be76 Fix term256 w/ max_colors=256 sans xterm/-256color
We were effectively inferring 256 color support **only**.
If terminfo reports 256 max_colors for this $TERM but
that is not named xterm or does not contain "256color" in name,
term256_support_is_native()'s result did not affect the recorded
support.

Noticed with Terminal.app set to nsterm, and a newer ncurses
with good terminfo for the terminal on modern OS X:

http://invisible-island.net/ncurses/terminfo.src.html#toc-_Apple__Terminal_app
2016-07-19 07:31:08 -07:00
Aaron Gyes
51e25e5a8d Add missing f_k_r includes 2016-07-18 08:47:37 -07:00
Kurtis Rader
20f28c2ef3 fish_indent --dump should deal with invalid code
Fixes #3241
2016-07-15 19:45:54 -07:00
ridiculousfish
f08ac969e9 Correctly handle trailing escaped spaces when completing
Fixes #2447
2016-07-11 14:03:53 -07:00
Aaron Gyes
1e27910b60 Merge branch 'master' of https://github.com/fish-shell/fish-shell 2016-07-11 01:49:13 -07:00
Aaron Gyes
09291735e6 Use locales preferred date format, fix up options
We don't seem to mention in the documentation that we were forcing
-t for all interactive uses. If we want to do that we should apply
that in the builtin.

history.fish reimplementing every option and doing things kind of
differently is a real pain and it's not clear if the docs are
referring to the or the wrapper script or both.
2016-07-11 01:45:30 -07:00
Kurtis Rader
512506f0f9 don't print internal token in error message
Attempting to execute something like `exec "$test"` results in a fish internal
token (a Unicode private use char) being printed in the resulting error
message. That's obviously not desirable as well as confusing.

Fixes #3187
2016-07-10 20:02:39 -07:00
Aaron Gyes
8cb560dc7e seems -t is what args.empty() tried to accomodate.
--with-time with no other arguments was showing no output.
2016-07-10 18:42:54 -07:00
Aaron Gyes
b2b327fec4 History's option handling broke --merge
Fixes #3220
2016-07-10 18:22:49 -07:00
ridiculousfish
ba12bcad33 Correctly set the generation count for background highlighting threads
Fixes #2789
2016-07-09 16:13:40 -07:00
ridiculousfish
8b06d2ad66 Untangle some fuzzy completion logic
Prior to this fix, when performing completions, we would prepend
the wildcard to the resulting files. When doing fuzzy completions,
we would take some wildcard segment, attempt to locate it in the
final completion, and then replace it with our fuzzy-matched directory.

With this fix, we pass along the "resolved so far" path, and prepend
that instead of doing "surgery" on the completion. This simplifies the
logic.

Fixes #3185
2016-07-09 15:27:10 -07:00
Kurtis Rader
14c7cfa84b make kill/pkill completions more robust (#3200)
Someone running fish in an unusual locale reported that an `assert()` was
firing when they typed `pkill c`. I traced it to two bugs. First, the
__fish_make_completion_signals command was producing a weird result. Second,
the builtin `complete` command wasn't adequately verifying its arguments.

Fixes #3129
2016-07-07 18:44:35 -07:00
Kurtis Rader
3c4e322ec1 make fish_indent options consistent with fish
Make `fish_indent`, `fish_key_reader` and `fish` recognize and assign
the same meaning to the `-d` and `-D` flags. Also, fix some errors and
stylistic issues in the associated man pages.

Fixes #3191
2016-07-05 20:22:44 -07:00
Aaron Gyes
f839282ac0 fish_key_reader had no -h output 2016-07-03 05:03:32 -07:00
Aaron Gyes
89c96c2114 Newline between fkr output should go to stderr 2016-07-03 02:16:39 -07:00
Aaron Gyes
86d9e5251a key_reader: status/diagnostic outputs to stderr
Remove isatty() check for stdout - this was added for both stdout
and stdin because "there is no reason to do that", but there is one:

Leaves only the bind command printed ot stdout, this allows
for one to do `fish_key_reader > bind_command.fish` to capture the bind
command while seeing the rest of the output.
2016-07-03 00:09:11 -07:00
Aaron Gyes
dff384e42d Fix fish_indent leaving colors set/messing up type
After the colorized syntax output in type -a foo, "foo is /usr/..."
would also be colored. (or 'test' in fish_indent foo.fish; echo test).

Make fish_indent reset the color when it's done.
2016-07-01 06:22:23 -07:00
Aaron Gyes
3d8e8a8715 Fix when fish isn't already installed
This was still wrong.
2016-07-01 04:34:04 -07:00
Aaron Gyes
af0f9e5308 Mispelling - surprised it didn't care. 2016-07-01 04:27:24 -07:00
Aaron Gyes
63120a9962 Fix fish_config in .app
* Copy docs into Resrouces
* Export $__fish_bin_dir
* Fix incorrect path in fish.cpp - fish is not in MacOS (it should be!)
2016-07-01 03:57:16 -07:00
Aaron Gyes
0045b46af8 Rename things to avoid conflicts with headers
Was breaking builds

 * ncurses.h: can declare `char *const key_name'.
 * netbsd term.h: has `newline', `lines' macros.
2016-07-01 02:48:50 -07:00
Kurtis Rader
68e167d576 f-k-r should use the user's locale
I did some research and experiments. For good or bad the `bind` command
requires the use of wide char codepoints (e.g., \u1234) for non-ASCII
chars.  So don't force the use of the POSIX locale, but do provide it as
an option for people who want to see the individual bytes rather than a
decoded wide char.

Simplify the format of the information displayed for each character. There
really isn't much point in providing decimal, octal, and hexadecimal. Just
print hex and symbolic representations.

Add an example `bind` command that a user can copy/paste.

Closes #3183
2016-06-30 20:49:56 -07:00
Kurtis Rader
262452d0b1 fix stupid copy/paste comment error from prev commit
When I fixed handling the TZ env var in commit dda890c I introduced a couple
of silly copy/paste comment errors. This corrects those comments.
2016-06-28 21:25:25 -07:00
Benjamin Barenblat
7e08679f1b history: Add option to show timestamps
Closes #677.
2016-06-28 19:46:54 -07:00
Kurtis Rader
dda890cf88 reset timezone state when TZ env var changes
When the TZ env var is modified change fish's internal timezone state.

Fixes #3181.
2016-06-28 18:06:39 -07:00
Aaron Gyes
44cde9e0e9 fish_key_reader #includes need to be updated 2016-06-28 02:57:14 -07:00
Kurtis Rader
d7bc20c933 don't allow f-k-r to run if stdin/stdout not a tty
Another developer noticed that redirecting stdin of `fish_key_reader`
results in weird behavior.  Which is not at all surprising. So add checks
to ensure stdin and stdout are attached to a tty.

Add some rudimentary unit tests for this program.
2016-06-26 21:51:00 -07:00
Kurtis Rader
e5011fbcdf fix fish_key_reader.cpp so it builds on linux 2016-06-26 17:38:19 -07:00
Kurtis Rader
0f5bfeead2 add more ways to exit fish_key_reader
A discussion on Gitter proposed allowing the user to signal their desire to
exit fish_key_reader by pressing \cC or \cD twice in a row. This implements
that.

I also decided to refactor how signals are handled. Most notably receiving a
signal will no longer print a diagnostic message unless you've enabled
debugging with `-d2` (or higher level).
2016-06-26 17:12:03 -07:00
David Adam
0f3b4d2bd8 Rewrite error messages for incorrect TERM 2016-06-26 16:24:01 +08:00
Kurtis Rader
046174397b fix setting the fish_key_reader locale
In addition to fixing the setting of the locale to C/POSIX this also
corrects several problems introduced by the commits made in the past
couple of days.  As a consequence of dealing with all of this I decided
to refactor the code to simplify one of the overly long functions I
introduced in my previous change.

Fixes #3168
2016-06-25 19:55:49 -07:00
Aaron Gyes
a6ec2dc3ed Remove oopsies while pasting.
(also, last commit log had a typo. "3.4.0-Microsoft" is the string we
should check for. Actual string in my code was correct.)
2016-06-25 01:10:58 -07:00
Aaron Gyes
6ec83568b5 Check for "Windows-3.4.0" as per MS's suggestion.
https://github.com/Microsoft/BashOnWindows/issues/545

Just looking for "Mirosoft" is rather general - we don't want to
enforce this strange behavior for Windows 12 (or the next beta.)
2016-06-25 00:31:46 -07:00
Kurtis Rader
b2a2705df4 croak if gettimeofday() fails
There is no conceivable way in which timef()'s invocation of gettimeofday()
can fail where it makes sense to continue running.  Yes, one such,
legitimate, failure mode is a 32-bit kernel and the date is greater than
2038-01-19 03:14:07. If you're running a fish binary on such a system
it's time to upgrade.  Otherwise, either the hardware or OS is broken.

Fixes #3167.
2016-06-24 19:32:46 -07:00
Aaron Gyes
0d6bdb38e6 Style fixes. 2016-06-23 22:48:45 -07:00
ridiculousfish
02cef2da23 history --merge to properly interleave items
Fixes #2312
2016-06-23 22:03:07 -07:00
Aaron Gyes
9c53019d95 fish_key_reader: ms were off by factor of ten.
Improve output.
2016-06-23 21:10:31 -07:00
Aaron Gyes
7a4065eb9f std::isnan() 2016-06-23 20:20:49 -07:00
Aaron Gyes
13eb302f3c proc_init() doesn't need to be called.
I don't know why I added that, that's how "bogosities" are born.
2016-06-23 18:28:49 -07:00
Aaron Gyes
6122ae83a6 Remove inadvertent change in fish_tests.cpp 2016-06-23 17:36:20 -07:00