Commit graph

10363 commits

Author SHA1 Message Date
ridiculousfish
c44dae2d73 Migrate certain runtime flags to atomics hidden behind functions 2019-05-18 18:50:28 -07:00
ridiculousfish
4fcb9d1fed Hide no_exec behind a function 2019-05-18 18:50:28 -07:00
ridiculousfish
be41407610 Make have_proc_stat an ordinary function
Removes a mutable global variable.
2019-05-18 18:50:28 -07:00
ridiculousfish
5158ee812b Eliminate the job from block_t
This exists only to support the '--on-job-exit caller' feature.
Just store the calling job ID directly in the parser's libdata.
2019-05-18 18:50:28 -07:00
Fabian Homborg
6e0cf5db6f docs/status: Fix synopsis
[ci skip]
2019-05-14 19:26:52 +02:00
Fabian Homborg
0aead5caf8 Repaint-mode to reexecute the rest if mode-prompt output is empty
We previously checked if fish_mode_prompt existed as a function, but
that's a bad change for those who already set it to an empty function
to have a mode display elsewhere.
2019-05-14 19:26:52 +02:00
ridiculousfish
005e6f2ab8 Revert "Don't service ioport completions if data is available on stdin"
This reverts commit 0453023f7b.

This broke the history tests. Reverting this while I sort it out.
2019-05-14 09:52:49 -07:00
Fabian Homborg
a7b1c2f76a Drop wcwidth ASCII check
Updated widechar_width takes care of it.

Technically, this does ~3 comparisons more per-character (because it
checks variation selectors and such), but that shouldn't really matter.
2019-05-14 09:49:51 +02:00
Fabian Homborg
2d37bc9bd1 Update widechar_width
This includes the change to check ASCII chars first, so we can now
drop our workaround.
2019-05-14 09:49:51 +02:00
Fabian Homborg
752b5362ee Only widen string if necessary
This tried a bunch of times, but only the final one is important.
2019-05-14 09:49:51 +02:00
Fabian Homborg
87b93cd4ca src/history: Only widen bash history lines once
This did str2wcs when checking, then again when adding.
2019-05-14 09:49:51 +02:00
Fabian Homborg
2aaf7fda27 src/history: Stop renarrowing a string in a for-loop
Classic case of doing stuff in a loop that doesn't change. No idea if
the compiler caught it, but I sleep easier now.
2019-05-14 09:49:50 +02:00
David Adam
b0f320481c document kill-path-component stopping at @ or :
Changes from 009ecfd7e6 / #5841.

[ci skip]
2019-05-14 13:18:22 +08:00
ridiculousfish
0453023f7b Don't service ioport completions if data is available on stdin
This defers certain autosuggestions and syntax highlighting until after
large pastes are complete.
2019-05-13 14:16:43 -07: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
Fabian Homborg
e22422c073 Don't do fish_setlocale that early
This just sets some special characters that we use in the reader, so
it only needs to be done before the reader is set up.

Which, as it stands, is in env_init().
2019-05-13 16:09:37 +02:00
ridiculousfish
234c97e6d2 Remove some unused variables 2019-05-12 18:23:00 -07:00
ridiculousfish
1719d6f136 Make $status and $pipestatus per-parser
Another step towards allowing multiple parsers to execute in parallel.
2019-05-12 14:00:44 -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
ridiculousfish
3d25ce1fd4 Merge remote-tracking branch 'takoyaki/ant_completion' into master 2019-05-11 23:22:45 -07:00
ridiculousfish
1e4ebfa470 Make electric variables a real thing
Use an actual struct to describe electric variables and what is special
about each one.
2019-05-11 19:17:33 -07:00
ridiculousfish
16fd780484 Reimplement the whole variable stack
The variable stack is a mess - confused locking, surprising callouts, and
unclear division of labor. Just reimplement the whole thing.
2019-05-11 19:17:16 -07:00
ridiculousfish
cfddd881ef Make PWD a per-processor variable
Handle this variable specially.
2019-05-11 17:13:34 -07:00
ridiculousfish
ee250aba82 Factor some environment setting into set_scoped_internal
Breaks up a monolith function.
2019-05-11 17:13:34 -07:00
ridiculousfish
15a52d0f0d Centralize some of the logic for walking the environment stack
Prepare to introduce a new node for per-process variables.
2019-05-11 17:13:34 -07:00
Fabian Homborg
adcc70d0b3 wcwidth: Return early for simple ASCII
Characters from space to before DEL are width 1, and they
appear *often*.

So it's quite a good idea to return early for them.

Fixes #5866.
2019-05-11 21:40:35 +02:00
Fabian Homborg
c27c8801af completions/git: Put local branches before unique remotes
With a few remotes, unique remote branches can get quite large, and
you probably mostly work on your own.

[ci skip]
2019-05-11 12:43:05 +02:00
Fabian Homborg
816df47c10 fish_clipboard_paste: Only trim leading whitespace on first line
We remove leading spaces so a paste isn't histignored, but we did so
on all lines, which removed indentation.

[ci skip]
2019-05-11 11:19:21 +02:00
Fabian Homborg
4462f6d600 src/screen: Skip a wcswidth
This stops trying to see if the previous line is wider if it is a
prefix of the current one.

Which turns out to be true often enough that it's a net benefit.
2019-05-11 10:43:38 +02:00
Fabian Homborg
ac983f6c4b src/screen: Stop recomputing wcwidth
This passes character width as an argument for a few functions.

In particular, it hardcodes a width of "1" for a space literal.
There's no reason to compute wcwidth for the length of the prompt.
2019-05-11 10:43:38 +02:00
Fabian Homborg
567b6ed2b5 src/screen: Stop doing a bunch of unnecessary work
This measured *all* the characters on the commandline, and saved all
of them in another wcstring_list_t, just to then do... nothing with
that info.

Also, it did wcslen for something that we already have as wcstring,
reserved a vector and did a bunch of work for autosuggestions that
isn't necessary if we have more than one line.

Instead, we do what we need, which is to figure out if we are
multiline and how wide the first line is.

Fixes #5866.
2019-05-10 17:43:46 +02:00
Fabian Homborg
d2b02a8a61 src/screen: Only check for combining marks if necessary
line_shared_prefix explains in its comment that

> If the prefix ends on a combining character, do not include the
  previous character in the prefix.

But that's not what it does.

Instead, what it appears to do is to return idx for *every* combining
mark. This seems wrong to begin with, and it also requires checking
wcwidth for *every* character.

So instead we don't do that. If we find the mismatch, we check if it's
a combining mark, and then go back to the previous character (i.e. the
one before the one that the combining mark is for).

My tests found no issues with this, other than a 20% reduction in
pasting time.
2019-05-10 17:43:46 +02:00
Fabian Homborg
eb41965ac3 reader: Remove superfluous while-loop
It's possible this was useful at some point, but now it just always
inserts the string the first time.
2019-05-10 17:43:46 +02:00
Fabian Homborg
3262c5ff44 docs: Document that complete -k does last calls first
Fixes #5868.

[ci skip]
2019-05-10 15:39:17 +02:00
Fabian Homborg
50ed5126f1 completions/git: Reorder some completions with --keep-order
They are displayed in LIFO-order, so it makes sense to e.g. put the
recent commits close to last (only before files) for `checkout`.

Fixes #5868.
2019-05-10 15:36:41 +02:00
Mahmoud Al-Qudsi
097d6c3c5b Fix order of operations in tilde comparison
The previous form of the statement evaluated to a constant comparison
and couldn't have been what was actually intended.
2019-05-09 01:22:23 -05:00
Per Bothner
4c0a119557 Disable cursor_down optimization, but fix to check c_oflag, but c_iflag.
The old commit #3f820f0 "Disable ONLCR mapping of NL output to CR-NL"
incorrectly used c_iflag instead of c_oflag, and I copied that error
in my patch.  Fixed that. However, there seems to be other problems
trying to use "\x1B[A", which I have not tried to debug, so comment that out.

(However, #3f820f0 seems to mostly work if we fix it to use c_oflag.)
2019-05-08 17:22:44 +02:00
Per Bothner
50db10a422 Alternate fix for cursor_down bound to "\n" and ONLCR set.
See GitHub issue #4505 "Terminal mode confusion"
and commit #3f820f0 "Disable ONLCR mapping of NL output to CR-NL".
2019-05-08 17:22:44 +02:00
Fabian Homborg
e20c08d04e argparse: Fix validation for short-only-flags
This read something like `o=!_validate_int`, and the flag modifier
reading kept the pointer after the `!`, so it created a long flag
called `_validate_int`, which meant it would not only error out form

```fish
argparse 'i=!_validate_int' 'o=!_validate_int' -- $argv
```

with "Long flag '_validate_int' already defined", but also set
$_flag_validate_int.

Fixes #5864.
2019-05-06 17:24:42 +02:00
Fabian Homborg
5bf21f2928 Penalize files ending in ~ in suggestions
Fixes #985.
2019-05-06 17:07:29 +02:00
Fabian Homborg
cc205a134b Disable fish_title in emacs 2019-05-06 17:06:40 +02:00
ridiculousfish
8a8b2513b5 Eliminate the global jobs() function
All job lists are attached to a parser now.
2019-05-05 11:33:08 -07:00
Fabian Homborg
afff93bdb2 Disable vi-cursor in tests
Otherwise this breaks if run inside a terminal that could do the cursor.
2019-05-05 17:31:33 +02:00
Fabian Homborg
8f3f4bbc9c CHANGELOG fish_indent semicolons and test stacktrace
[ci skip]
2019-05-05 15:22:01 +02:00
Fabian Homborg
8d9782301e docs: Call "arrays" "lists"
We were flip-flopping between the two terms, so we now use one. We
still mention "array" in the chapter, and it's still `read --array`,
though.

Fixes #5846.

[ci skip]
2019-05-05 14:01:07 +02:00
Fabian Homborg
d83636f70e completions/git: Handle AD files
Added files that were deleted after. These count as both added and
deleted.

Fixes #5861.

[ci skip]
2019-05-05 13:49:11 +02:00
Fabian Homborg
bcce6d691f Keep "; and" and "; or" on fish files
This reformats *.fish files from before commit
c2970f9618 with the changes to fish_indent.

[ci skip]
2019-05-05 13:34:38 +02:00
Fabian Homborg
46b804cf19 fish_vi_cursor: Don't fail if --force-iterm is given in non-iterm
Otherwise this would have used it as the terminal.

Fixup!

[ci skip]
2019-05-05 13:05:19 +02:00
Fabian Homborg
e952f60b02 functions/fish_vi_cursor: Disable on iTerm, allow override
I still don't get #3696, so let's just offer an override for now.

[ci skip]
2019-05-05 13:01:02 +02:00
Fabian Homborg
7451443050 functions/fish_vi_cursor: Cleanup
Removes the unused "uses_echo" variable and adds some comments.

[ci skip]
2019-05-05 12:57:14 +02:00