Commit Graph

14 Commits

Author SHA1 Message Date
ridiculousfish
9ce3ac5b93 Remove R_SENTINAL
It was unused and misspelled.
2018-01-29 11:30:11 -08:00
Kurtis Rader
509ee64fc9 implement our own assert() function
I recently upgraded the software on my macOS server and was dismayed to
see that cppcheck reported a huge number of format string errors due to
mismatches between the format string and its arguments from calls to
`assert()`. It turns out they are due to the macOS header using `%lu`
for the line number which is obviously wrong since it is using the C
preprocessor `__LINE__` symbol which evaluates to a signed int.

I also noticed that the macOS implementation writes to stdout, rather
than stderr. It also uses `printf()` which can be a problem on some
platforms if the stream is already in wide mode which is the normal case
for fish.

So implement our own `assert()` implementation. This also eliminates
double-negative warnings that we get from some of our calls to
`assert()` on some platforms by oclint.

Also reimplement the `DIE()` macro in terms of our internal
implementation.

Rewrite `assert(0 && msg)` statements to `DIE(msg)` for clarity and to
eliminate oclint warnings about constant expressions.

Fixes #3276, albeit not in the fashion I originally envisioned.
2017-02-14 18:48:27 -08:00
Kurtis Rader
5b6cc5af6d time for another make style-all
Gotta keep the entropy (i.e., disorder) from increasing.
2017-01-26 20:05:46 -08:00
ridiculousfish
439f233ccc Make fire_event_callback take a std::function instead of function pointer 2017-01-21 17:15:45 -08:00
Kurtis Rader
d982427216 remove unused function
The fish_key_reader program was the only user of the
`set_wait_on_escape_ms()` function and that use was removed with commit
0461743. So remove it from the main fish code. This was found by `make
lint`.
2016-10-22 21:08:53 -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
b055b8440c enhance the key_reader program
The original `key_reader` program was useful but didn't do much that `xxd`
or `od -tx1z` didn't do. Furthermore, it wasn't built and installed by
default. This change adds features that make it superior to those programs
for decoding interactive key presses and makes it a first-class citizen
like the `fish_indent` program that is always available.

Fixes #2991
2016-05-10 14:11:30 -07:00
Kurtis Rader
da17420cdf restyle input_common module to match project style
Reduces lint errors from 27 to 24 (-11%). Line count from 466 to 378 (-19%).

Another step in resolving issue #2902.
2016-05-01 20:02:16 -07:00
Kurtis Rader
1f06e5f0b9 add better support for IWYU and fix things
Remove the "make iwyu" build target. Move the functionality into the
recently introduced lint.fish script. Fix a lot, but not all, of the
include-what-you-use errors. Specifically, it fixes all of the IWYU errors
on my OS X server but only removes some of them on my Ubuntu 14.04 server.

Fixes #2957
2016-04-26 15:02:22 -07:00
Federico Ferri
168a156e58 implement swap-selection-start-stop function
The swap-selection-start-stop function goes to the other end of the highlighted text, the equivalent of `o' for vim visual mode.

Add binding to the swap-selection-start-stop function, `o' when in visual
mode.

Document swap-selection-start-stop, begin-selection, end-selection, kill-selection.
2016-03-20 19:22:04 -07:00
Kurtis Rader
f2246dfb34 reduce number of Unicode private-use characters
This narrows the range of Unicode codepoints fish reserves for its own
use from U+E000 thru U+F8FE (6399 codepoints) to U+F600 thru U+F73F (320
codepoints). This is still not ideal since fish shouldn't be using any
Unicode private-use codepoints but it's a step in the right direction.

This partially addresses issue #2684.
2016-02-28 18:36:34 -08:00
Kurtis Rader
4b9fece9f4 allow configuring the escape delay timeout
Introduce a "fish_escape_delay_ms" variable to allow the user to configure the
delay used when seeing a bare escape before assuming no other characters will
be received that might match a bound character sequence. This is primarily
useful for vi mode so that a bare escape character (i.e., keystroke) can
switch to vi "insert" to "normal" mode in a timely fashion.
2016-01-17 17:45:30 -08:00
David Adam
3929e9de0e Merge branch 'master' into iwyu 2015-07-26 10:20:13 +08:00
ridiculousfish
b4f53143b0 Migrate source files into src/ directory
This change moves source files into a src/ directory,
and puts object files into an obj/ directory. The Makefile
and xcode project are updated accordingly.

Fixes #1866
2015-07-24 00:59:27 -07:00