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
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.
* 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.
```
~ $ set -e TERM; fish
Assertion failed: (!is_missing), function c_str, file src/env.cpp, line 690.
fish: 'fish' terminated by signal SIGABRT (Abort)
```
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
* 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
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
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.
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.
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
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.
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.
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.
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.
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.
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
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`.