Commit Graph

343 Commits

Author SHA1 Message Date
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
Aaron Gyes
fa78a7101c Make IWYU output in lint.cpp less messy
And re-run IWYU, adjust #includes.
2016-06-23 17:26:08 -07:00
Aaron Gyes
290e936322 Fix up key_reader
* Correct notice about ^C
* Move time deltas to end of the line away from the important info on
  left.
* Use timef() instead of gettimteofday() ourselves
* Show time in ms (is this even useful in any unit? Maybe testing escape
  delays...)
* Make init more similar to other apps.
2016-06-23 07:43:55 -07:00
Aaron Gyes
db2c128b24 Fix crash with empty $TERM
```
~ $ set -e TERM; fish
Assertion failed: (!is_missing), function c_str, file src/env.cpp, line 690.
fish: 'fish' terminated by signal SIGABRT (Abort)
```
2016-06-21 10:30:53 -07:00
Kurtis Rader
8e21d5de92 deal with broken ttys on MS Windows
The tty device timestamps on MS Windows aren't usable because they're always
the current time. So fish can't use them to decide if the entire prompt needs
to be repainted.

Fixes #2859
2016-06-18 19:33:54 -07:00
Aaron Gyes
2cabcf4ad4 bg had also had wrong exit code for some errors
Stop printing usage information when error isn't a usage problem.
Add simple test for bg and fg
2016-06-18 08:26:07 -07:00
Aaron Gyes
20d36f16d3 fg: fix exit code (was 1 if success else 0)
returning a C boolean for builtin_fg success was backwards
2016-06-18 07:41:27 -07:00
Kurtis Rader
0ca103686f remove unset vars from the environment
Remove vars from the environment that are no longer set. Simplify the code by
removing an unnecessary loop. Add some tests.

Fixes #3124
2016-06-15 22:10:11 -07:00
Kurtis Rader
3cecc1f475 trivial locale cleanups
Clarify the purpose of the `N_()` macro. Remove inconsistent capitalization of
two strings in the parser module.
2016-06-14 19:57:07 -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
Kurtis Rader
d70be18c42 use fish_wcwidth rather than wcwidth
Minor cleanup related to issue #2199.
2016-06-14 17:17:31 -07:00
Aaron Gyes
1499ade89c Restyle touched .cpp files 2016-06-12 11:34:35 -07:00
Aaron Gyes
0310d3bd8c Improve fish_indent -w error output
Show small usage blurb, add newline to end.
2016-06-12 11:25:38 -07:00
Aaron Gyes
02375982df Hand-build 256, 24-bit color esc strings same way
... using snprintf() for the 256-color function in same manner as the
24-bit function.
2016-06-12 11:22:31 -07:00
Aaron Gyes
5435f60f31 Improve comments, update Doxyfile
Some changes were cribbed from #1317
2016-06-12 11:19:44 -07:00
Aaron Gyes
b72ed1fa8c Fix env_universal_common.cpp filesize comparisons.
* if (result == ULLONG_MAX) is always false, likely a typo as
  result is unsigned long, and the comment says ULONG_MAX.

* use off_t instead of size_t for file size where it can mismatch
  st_size's type in stat.h
2016-06-12 03:52:58 -07:00
ridiculousfish
3a7719015d Don't allow specifying an fd with a caret redirection
For example, an argument 12345^ is a real argument, not a redirection
There's no reason to use ^ here instead of >, and it's annoying to git
users.

Fixes #1873
2016-06-12 02:16:46 -07:00
Aaron Gyes
0ee03cbf98 Error on -w without a path before reading stdin
Oops, `fish_indent -w` just sits there waiting for input if nothing
is pointing at it, only to give user the error afterwards.
2016-06-12 01:07:33 -07:00
Aaron Gyes
c4e322d3ad Fix crash when fish_indent is using stdin with -w
When given no path, the logic was happy to try to use
an unitialized output_location.

  $ fish_indent -w < test.fish
  Opening "(null)" failed: Bad address

Initialize the string, and repair the logic to catch this case
and report the problem correctly.
2016-06-10 08:02:12 -07:00
Corey Ford
9d2092bf9f don't print header for each job 2016-06-08 21:15:07 -07:00
Aaron Gyes
7ef40f4e53 Merge pull request #3118 from floam/headerdoc-fixes
Update Xcode project, HeaderDoc comments.

Fix various invalid HeaderDoc comments.  Normalize autoload.cpp/autoload.h as an example of something closer to "proper" HeaderDoc formatting.

Have clang/Xcode validate HeaderDoc comments. Remove key_reader.cpp from Xcode project.
2016-06-05 21:42:01 -07:00
Aaron Gyes
2fafb13eaa Be a bit more consistent and proper. 2016-06-05 21:32:57 -07:00
Aaron Gyes
90ee810c73 These autoload comment should be HeaderDoc comments. 2016-06-05 19:24:23 -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
Kurtis Rader
9f21e3792a remove dependency on dcgettext()
While fixing issue #3110 I noticed there is exactly one place we use
dcgettext() and that use is completely unnecessary. So remove it.
2016-06-05 18:52:19 -07:00
Kurtis Rader
0b385f145c simplify, and fix, setting the current locale
Fix test setup bogosities. Specifically, they weren't hermetic with respect to
locale env vars.

Rewrite the handling of locale vars to simplify the code and make it more like
the pattern most programs employ.

Fixes #3110
2016-06-05 15:49:34 -07:00
Kurtis Rader
53e865b654 put curses/terminfo vars into the environment
We need to actually export the curses/terminfo env vars in order for
`setupterm()` to be able to use them. While fixing this I reworked the
fallback logic implemented by @zanchey in response to issue #1060 in
order to simplify the logic and clarify the error messages.

This does not allow someone to change the curses/terminfo env vars after
the first prompt is displayed (you can but it won't affect the current
fish process). It only makes it possible to set `TERM`, `TERMINFO`, and
`TERMINFO_DIRS` in *config.fish* or similar config file and have them be
honored by fish.
2016-06-03 17:16:41 -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
Beni Cherniavsky-Paskin
63a851cfd6 mention nullglob exceptions in failglob error msg 2016-06-02 19:51:19 -07:00
Kurtis Rader
db1ec847f9 fix lint error in wgettext()
Cppcheck was complaining about the `return val.c_str()` at the end of the
`wgettext()` function. That would normally a bug since the lifetime of
`val` ends when the function returns. In this particular case that's not
true because the string is interned in a cache. Nonetheless, rather than
suppress the lint warning I decided to modify the API to be more idiomatic.

In the process of fixing the aforementioned lint warning I fixed several other
lint errors in that module.

This required making our copy of `wgetopt()` compatible with the rest of
the fish code. Specifically, by removing its local definitions of the
"_" macro so it uses the same macro used everywhere else in the fish
code. The sooner we kill the use of wide chars the better.
2016-06-01 22:19:03 -07:00
Fabian Homborg
8d6735cb41 Make string match -rnv work
Fixes #3098.
2016-05-31 23:24:08 +02:00
Kurtis Rader
3d74b160b3 simplify some fish_tests code
This came to my attention because cppcheck was warning about possibly
dereferncing a NULL pointer.
2016-05-30 17:31:41 -07:00
Kurtis Rader
5bf1b0e5f5 fix random lint issues
This only eliminates errors reported by `make lint`. It shouldn't cause any
functional changes.

This change does remove several functions that are unused. It also removes the
`desc_arr` variable which is both unused and out of date with reality.
2016-05-29 22:24:29 -07:00
Fabian Homborg
ffcfe73299 Allow suggestion when selecting in pager
Also mentioned in #3016.
2016-05-27 15:02:56 -07:00
Fabian Homborg
2885c085d8 Allow autosuggestion after completion
It seems kinda silly to not directly do it, but it was explicitly
stopped in the code.

I'm quite good at deleting that, aren't I?

Fixes #3016.
2016-05-27 15:02:56 -07:00
Kurtis Rader
9ad3488b5d fix some style bogosities that crept in 2016-05-27 14:44:30 -07:00
Kurtis Rader
8f420b9272 Fix wide char related tests on Cygwin
This makes the wide char tests run by `./fish_tests` pass on systems where
sizeof wchar_t is two (e.g., Cygwin). In doing so it corrects several
problems with the underlying code in module *utf8.cpp* such as allowing
five and six byte UTF-8 sequences. They were allowed by the original
Unicode proposal but are not allowed by the adopted standard.
2016-05-26 20:24:03 -07:00
Fabian Homborg
95635a5982 Remove $version
It's too generic a name - which both does not communicate what it is and
prevents someone else from using it.
2016-05-26 18:27:37 +02:00
Kurtis Rader
d1208386d2 tty driver ignore lnext (\cV) and werase (\cW)
Configure the tty driver to ignore the lnext (\cV) and werase (\cW) characters
so they can be bound to fish functions.

Correct the `fish_key_bindings` program to initialize the tty in the same
manner as the `fish` program.

Fixes #3064
2016-05-25 12:05:39 -07:00
Fabian Homborg
2f51088bfb kill: Remove xsel integration
Overwriting the user's clipboard by default is annoying and contributors
don't use it.

This is better served via an explicit binding that calls e.g. `xsel`.
2016-05-25 16:10:16 +02:00