Commit Graph

216 Commits

Author SHA1 Message Date
ridiculousfish
273afca3da Remove some dead code 2020-01-15 11:59:40 -08:00
Rosen Penev
49fbca8a8b
[clang-tidy] Remove redundant const in function declarations
Found with readability-avoid-const-params-in-decls
2019-12-26 21:25:12 -08:00
Rosen Penev
f2e7def667
[clang-tidy] Remove const from strings
Found with readability-const-return-type
2019-12-26 21:25:12 -08:00
Rosen Penev
9936362599 common.cpp: Don't always include cxxabi.h
cxxabi.h is not available with LLVM's libcxx
2019-12-18 21:03:51 -06:00
Rosen Penev
4087b2ee15 [clang-tidy] Use bool literals
Found with modernize-use-bool-literals

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-29 23:46:50 -08:00
Rosen Penev
69d0bb7c0d io.h: Add missing override
Found with clang's -Winconsistent-missing-destructor-override

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:50:40 -08:00
Rosen Penev
586ac3dfa7 [clang-tidy] Convert loops to range based
Found with modernize-loop-convert

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:50:40 -08:00
Rosen Penev
1055ff321c [clang-tidy] Replace NULL with nullptr
Found with modernize-use-nullptr

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:23:03 -08:00
Rosen Penev
0dfa7421f3 [clang-tidy] Convert C casts to C++ ones
Found with google-readability-casting

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:17:49 -08:00
Rosen Penev
7f62e30731 [clang-tidy] Replace size comparisons with empty
Found with readability-container-size-empty

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:13:33 -08:00
Jason
3cf6ebc0e1 Amend typos and grammar errors 2019-11-25 13:07:15 +01:00
ridiculousfish
c8332bae8c sucess -> success, failiure -> failure 2019-10-18 18:36:03 -07:00
ridiculousfish
82eca4bc86 Run clang-format on all files
The main change here is to reorder headers.
2019-10-13 15:50:48 -07:00
David Adam
3ae12ac4d3 Revert "Escape separators (colon and equals) to improve completion"
This reverts commit f7dac82ed6 from pull
request #6059.

As discussed in #6099, this caused a regression in some completions (eg
dd).
2019-09-19 14:38:16 +08:00
ridiculousfish
06269ed67d Remove NOT_A_WCHAR
It's now unused.
2019-09-14 13:18:04 -07:00
ridiculousfish
8747018cbc Use maybe_t in unescape_string_internal 2019-09-14 13:17:22 -07:00
ridiculousfish
fa1dab040b Use maybe_t in read_unquoted_escape 2019-09-14 12:54:38 -07:00
ridiculousfish
cc5e29734b Use maybe_t in string_last_char 2019-09-14 11:56:02 -07:00
Johannes Altmanninger
f7dac82ed6 Escape separators (colon and equals) to improve completion
Fish completes parts of words split by the separators, so things like
`dd if=/dev/sd<TAB>` work.
This commit improves interactive completion if completion strings legitimately
contain '=' or ':'.  Consider this example where completion will suggest
a🅰️1 and other files in the cwd in addition to a:1

touch a:1; complete -C'ls a:'

This behavior remains unchanged, but this commit allows to quote or escape
separators, so that e.g. `ls "a:<TAB>` and `ls a\:<TAB>` successfully complete
the filename.

This also makes the completion insert those escapes automatically unless
already quoted.
So `ls a<TAB>` will give `ls a\:1`.

Both changes match bash's behavior.
2019-09-02 14:27:21 -07:00
Mahmoud Al-Qudsi
af4b54e635 Change WSL version check to a hard error, but include a bypass
Instead of warning (debug level 1), we now emit an error (debug level 0) if a known bad version of
WSL is detected. However, `FISH_NO_WSL_CHECK` can now be defined to skip both the check and the
startup message.
2019-08-25 18:50:17 -05:00
Mahmoud Al-Qudsi
44022e65c2 Revert "Remove the WSL warning"
This reverts commit 5101bdeb9f.
2019-08-25 18:29:46 -05:00
ridiculousfish
5101bdeb9f Remove the WSL warning
This warning is annoying and there is no way to disable it.

Ping #5661. Ping #5298. Closes #6038
2019-08-16 20:59:53 -07:00
ridiculousfish
4a2c709fb1 Eliminate shell_is_interactive
We used to have a global notion of "is the shell interactive" but soon we
will want to have multiple independent execution threads, only some of
which may be interactive. Start tracking this data per-parser.
2019-06-29 11:28:26 -07:00
Fabian Homborg
370f5356a1 Move "character has no narrow representation" to flog
This was a warning, which is kind of ridiculous, as it's inactionable
error spew.

Fixes #2815.
2019-06-19 12:36:38 +02:00
ridiculousfish
fc99d6c7af clang-format all files 2019-06-03 20:30:48 -07:00
Fabian Homborg
87971e1f2e Widen the rest of the FLOGs
Fixes #5900.
2019-05-30 13:08:35 +02:00
Fabian Homborg
d73ee4d54b More using FLOGF when formatting is needed
sed-patched, every time a "%" is used in a call to `FLOG`, we use
`FLOGF` instead.
2019-05-30 11:54:09 +02:00
ridiculousfish
0863c237b0 Make thread_id a visible thing
Every thread now has a non-recyclable thread id. This will be an aid in
debugging.
2019-05-29 12:34:11 -07:00
ridiculousfish
835c6ffa67 clang-format all files 2019-05-27 19:47:13 -07:00
ridiculousfish
ea9d1ad82f Convert debug(0) calls to FLOG 2019-05-27 17:31:17 -07:00
ridiculousfish
b405b979ec Eliminate the CHECK() macro
This thing was pretty useless.
2019-05-27 17:24:19 -07:00
ridiculousfish
5a4df9dd3a Use sigint_checker_t in debug_thread_error 2019-05-25 19:19:03 -07:00
ridiculousfish
363652ad76 debug_thread_error to wait for a signal instead of sleep
Allows for control-C out of it
2019-05-21 20:15:59 -07:00
Fabian Homborg
967c1d51ee Only do brace expansion if they contain a variable or ","
Brace expansion with single words in it is quite useless - `HEAD@{0}`
expanding to `HEAD@0` breaks git.

So we complicate the rule slightly - if there is no variable expansion
or "," inside of braces, they are just treated as literal braces.

Note that this is technically backwards-incompatible, because

    echo foo{0}

will now print `foo{0}` instead of `foo0`. However that's a
technicality because the braces were literally useless in that case.

Our tests needed to be adjusted, but that's because they are meant to
exercise this in weird ways.

I don't believe this will break any code in practice.

Fixes #5869.
2019-05-19 18:23:27 +02:00
ridiculousfish
277db64804 Force termsize back to valid in get_current_winsize()
get_current_winsize() is intended to be lazy. It does the following:

1. Gets the termsize from the kernel
2. Compares it against the current value
3. If changed, sets COLUMNS and LINES variables

Upon setting these variables, we notice that the termsize has changed
and invalidate the termsize. Thus we were doing this work multiple times
on every screen repaint.

Put back an old hack that just marked the termsize as valid at the end
of get_current_winsize().
2019-05-13 14:05:42 -07:00
ridiculousfish
234c97e6d2 Remove some unused variables 2019-05-12 18:23:00 -07:00
ridiculousfish
8031fa3bdb Stop using atomic types for non-primitives
atomic<winsize> requires linking libatomic on some platforms which is
annoying. Remove the one use.

Fixes #5865
2019-05-12 13:07:37 -07:00
Fabian Homborg
c2970f9618 Reformat all files
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.

If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00
ridiculousfish
e2c66a8131 Make termsize thread safe 2019-05-04 20:58:35 -07:00
ridiculousfish
fe68287cb0 Make miscellaneous variables thread-safe 2019-05-04 20:58:35 -07:00
ridiculousfish
f66e010949 Turn a lot of common.h variables into getter functions
Improves thread safety.
2019-05-04 20:58:35 -07:00
ridiculousfish
ec45f31ad1 Make debug_level an atomic
Fixes a tsan warning
2019-05-04 15:28:44 -07:00
Aaron Gyes
4e555aebec Remove is_whitespace and whitespace character string declarations
I don't doubt such functions and character arrays could be useful,
to keep things consistent, but they are not actually being used.
2019-04-06 02:07:56 -07:00
ridiculousfish
71f26a6813 Remove INPUT_COMMON_BASE
We no longer store readline commands as characters, so there's no need to
reserve character space for them.
2019-03-23 23:31:37 -07:00
Mahmoud Al-Qudsi
c50cce298d Allow the omitted new line character to be more than one char
The code already allowed for variable width (multicell) *display* of the
newline omitted character, but there was no way to define it as being
more than one `wchar_t`.

This lets us use a string on console sessions (^J aka newline feed)
instead of an ambiguous character like `@` (used in some versions of
vim for ^M) or `~` (what we were using).
2019-03-20 21:47:34 -05:00
Mahmoud Al-Qudsi
753d489376 Fall back to simpler special characters in console sessions 2019-03-20 21:47:34 -05:00
Mahmoud Al-Qudsi
4aded78fc9 Add is_console_session() to detect physical vty 2019-03-20 21:47:32 -05:00
Aaron Gyes
d837eee09d remove some wcstring -> wchar_t* -> wcstring conversions
Mostly related to usage _(L"foo"), keeping in mind the _
macro does a wcstring().c_str() already.

And a smattering of other trivial micro-optimizations certain
to not help tangibly.
2019-03-14 15:21:08 -07:00
Aaron Gyes
477b2e8d7c std::vector<wcstring> is wcstring_list_t 2019-03-14 11:17:26 -07:00
Aaron Gyes
0ee9862809 Write out backtrace in one debug(), add \n after it.
The goal here is to make fish -dn -Dn output a little easier
to scan visually.
2019-03-14 10:56:24 -07:00