Commit Graph

12185 Commits

Author SHA1 Message Date
David Adam
30a8345a11 create_manpage_completions: use the first tool found
Noted in https://github.com/fish-shell/fish-shell/pull/6879#discussion_r421731269
2020-05-10 21:56:12 +08:00
David Adam
6bd563ca32 history: use mode 0600 for creating history file
Fixes #6926.
2020-05-10 21:28:16 +08:00
Jason Nader
90c89c877f Use short flag for --description for consistency in code base 2020-05-08 22:58:52 +02:00
Johannes Altmanninger
5cd7c3a30b Teach builtin functions about -t for --handlers-type
Fixes #6985
2020-05-08 22:47:40 +02:00
Jason Nader
bb65f81e64 edit_command_buffer: Add line:col support for micro 2020-05-08 20:00:07 +02:00
Jason
96c4cbc1bd Document addition of string split --fields 2020-05-08 22:37:50 +08:00
Eamon Caton
b665604475 Add newline to history clear message for consistency 2020-05-08 22:36:57 +08:00
David Adam
c2942a70d6 common.h: drop some unused macros
Last use removed in 81ded4c0ab.
2020-05-08 22:17:26 +08:00
Bjorn Neergaard
3f9fca6696 Update /etc/config.fish to use current syntax
The long option usage of `status` is deprecated and to be removed by fish 3.0.
2020-05-08 15:20:36 +08:00
Fabian Homborg
e390ee12c2 Disable flaky pipeline-pgroup test
This fails *a lot* on Travis, obscuring other tests.

As far as we can tell, a newline is somehow sneaking in here.

See #6693
2020-05-07 21:19:28 +02:00
Ron Gebauer
54f3fbbf8c
Fix issue if md5sum is used instead of md5 (#6958)
* Fix issue if md5sum is used instead of md5

Both have a different output which results in different array sized

Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>

* Add feedback

Signed-off-by: Ron Gebauer <ron.gebauer@raytion.com>
2020-05-07 21:02:22 +02:00
Bjorn Neergaard
02e9486559
Fix manpath handling in create_manpage_completions.py (#6879)
* Fix manpath handling in create_manpage_completions.py

...as well as do some (very!) light cleanup.

Currently, `create_manpage_completions.py` does not properly
understand/respect the `$MANPATH` variable. One important feature of
`$MANPATH` is that an empty component (i.e. the trailing : in
`foo:bar:`) expands to the 'default' or 'system' path -- that is to say,
the path that would be used if `$MANPATH` was unset. This allows the
user to extend the manpath without clobbering it, and has been a feature
many Unices have included for years.

The current implementation blindly uses the `$MANPATH` variable if it
exists, which does not allow for this behaviour -- to expand the
variable correctly, an external program must be invoked. Therefore, we
first shell out to the 'proper' (read: best guess) external program. If
that fails, we can then try to use `$MANPATH` directly/literally.
Finally, if both of those are impossible, we can fall back to some
common paths from widely used operating systems.

Note that the `man.conf` parsing has been removed: this is because while
many 'traditional' Unices (BSDs, Solaris, macOS) support this file, only
macOS actually ships a file -- most other Unices use a `conf.d`-style
layout and supporting that from our Python is impractical and silly at
best. On GNU (read: Linux) systems, `mandb` uses `/etc/man_db.conf` with
slightly different syntax and sematics. As this code-path has bitrotted
(and likely never worked, anyway), just remove it.

`create_manpage_completions.py` looks like it has suffered a lot of
confusion and bitrot in general over the last few years -- and is
overdue for a major refactoring. I am quite interested in tackling this,
but I plan to wait until the go-ahead to drop support for Python 2 is
given, as a major refactor/rewrite that still supports Python 2 (and
thus ignores the ergonomic/API/syntax improvements of Python 3) does not
make sense to me.

Related: #5657

It would probably be good to revisit `man.fish` once again when a
comprehensive refactor happens: hopefully every permutation of
`man`/`$MANPATH` could be documented as part of that effort.

* Restore /etc/man.conf parsing

I was not aware that this codepath was used -- since it appeared that it
would throw an error when it was reached. Redo it, using regex, and
support parsing NetBSD man.conf as well (untested).

* Fix create_manpage_completions.py under Python 2
2020-05-07 21:01:02 +02:00
Fabian Homborg
3c6c8d5424 fish_vi_cursor: Add alacritty to the whitelist 2020-05-07 18:04:39 +02:00
Fabian Homborg
81ded4c0ab Don't default term size if it is too small
This is unlikely to achieve anything sensible.

Fixes #6980.
2020-05-07 17:42:02 +02:00
David Adam
ec74c739c8 bindings: expand abbreviations with all end-of-command characters
Closes #6970.
2020-05-07 09:13:33 +08:00
Charles Gould
ad020e84dd Exit key reader normally on help, version 2020-05-05 12:33:22 +08:00
Charles Gould
bd472ececc Add fish_trace to special variable completions 2020-05-03 21:20:24 +08:00
Fabian Homborg
3e29b0d916 fish_vi_cursor: Allow new Konsole
It removed $KONSOLE_PROFILE_NAME and added $KONSOLE_VERSION.

Let's assume if $KONSOLE_PROFILE_NAME is set we use the old sequences,
if not we use the new ones.
2020-05-02 17:42:42 +02:00
ridiculousfish
aa8c9df2d0 Stop copying a string in hash<const wcstring> 2020-05-01 13:30:56 -07:00
Rosen Penev
0668513138 Change C casts to C++ ones
Some were kept for compatibility.

Found with -Wold-style-cast

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-05-01 13:30:56 -07:00
David Adam
f36c82ce86 Reenable command descriptions on macOS 10.15.4+
Further work on #6270, as recommended in 611a6589ea.

[ci skip]
2020-05-01 21:28:43 +08:00
ridiculousfish
a1494c9c22 Revert "__fish_describe_command: print only exact match and exit"
This reverts commit 535845861a.

That commit introduced a bug where tab-completing commands no longer
prints their descriptions, unless there is an exact match.
2020-04-30 11:09:46 -07:00
ridiculousfish
4116829292 Do not issue clr_eos if we think the cursor will end up on its own line
If we output text and end up in the last column, the sticky right edge
will cause a clr_eos to erase the last character. Ensure this doesn't
happen by not issuing clr_eos in that case.

Fixes #6951
2020-04-29 14:22:54 -07:00
ridiculousfish
8c4c9d050d Clear cancellation signals after handling a readline command
If a readline command is bound to a key sequence which also sends a
signal, then fish will set the cancel flag in addition to handling the
command. But this cancel flag is then persistent. Ensure it gets cleared
after each command.

Fixes #6937
2020-04-29 13:38:15 -07:00
David Adam
8d43439640 wutil: add SMB2 file type to fd_check_is_remote
The manual page for statfs(2) only lists SMB_SUPER_MAGIC and
CIFS_MAGIC_NUMBER, but it turns out there's a third type of CIFS/SMB
mount, represented by SMB2_MAGIC_NUMBER.

Haunting me from #6609.
2020-04-29 23:34:13 +08:00
hyperfekt
31cb615671 __fish_config_interactive: use __fish_anypython 2020-04-29 14:17:16 +08:00
David Adam
4a6438f59a Merge branch 'Integration_3.1.2' 2020-04-29 12:16:24 +08:00
David Adam
0314b0f1d9 Release 3.1.2 2020-04-29 10:54:40 +08:00
ridiculousfish
b88b6ea504 Add CMake variable FISH_USE_SYSTEM_PCRE2
The CMake variable FISH_USE_SYSTEM_PCRE2 now controls whether fish uses
system PCRE2 or the bundled version. The default is to use the system
version, unless no such version is found, or unless it is a macOS build
with code signing. Note the default behavior has not changed.

Fixes #6952
2020-04-28 18:30:40 -07:00
ridiculousfish
2951c05934 Do not consider dumb terminals to have wrapping
For the purpose of cursor_is_wrapped_to_own_line, always return false
for dumb terminals. Fixes the tests.
2020-04-28 16:30:52 -07:00
ridiculousfish
4f103d74fb Do not emit newline when running commands if the cursor is on its own line
If the cursor has been wrapped to the last line, and is the only thing
on that line, do not emit a newline when executing a command.

Fixes #6826
2020-04-28 11:51:46 -07:00
ridiculousfish
81af389258 Modernize screen_t
Use inline initializers rather than the constructor, and adopt some
maybe_t.

Also move post_buff_1 and post_buff_2 to local variables instead of
member variables.
2020-04-28 11:26:06 -07:00
ridiculousfish
520c83cbbf Make screen_reset_mode_t an enum class instead of an enum
Improves type safety.
2020-04-28 11:00:26 -07:00
ridiculousfish
844ae48dc0 Apply code review from #6806 2020-04-28 10:54:48 -07:00
ridiculousfish
9aad39f89d Note fix for #6955 in changelog 2020-04-28 10:48:15 -07:00
ridiculousfish
eabe2e8855 Allow eval to see the tty if its output is not piped
Commit 5fccfd83ec, with the fix for #6806,
switched eval to buffer its output (like other builtins do). But this
prevents using eval with commands that wants to see the tty, especially
fzf. So only buffer the output if the output is piped to the next process.
2020-04-28 10:47:43 -07:00
ridiculousfish
f3d31f6ef6 Introduce out_is_piped and err_is_piped on io_streams_t
builtin_eval needs to know whether to set up bufferfills to capture its
output and/or errput; it should do this specifically if the output and
errput is piped (and not, say, directed to a file). In preparation for
this change, add bools to io_streams_t which track whether stdout and
stderr are specifically piped.
2020-04-28 10:47:39 -07:00
ridiculousfish
3a47db74b0 Disable Mac codesigning if MAC_CODESIGN_ID is falsey
Fixes #6952
2020-04-28 10:34:06 -07:00
ridiculousfish
84a2f32625 Note fix for #6955 in changelog 2020-04-28 10:26:15 -07:00
ridiculousfish
80e92581aa Allow eval to see the tty if its output is not piped
Commit 5fccfd83ec, with the fix for #6806,
switched eval to buffer its output (like other builtins do). But this
prevents using eval with commands that wants to see the tty, especially
fzf. So only buffer the output if the output is piped to the next process.

This will solve #6955 (which needs to go into a point release).
2020-04-28 10:08:00 -07:00
ridiculousfish
607779257c Introduce out_is_piped and err_is_piped on io_streams_t
builtin_eval needs to know whether to set up bufferfills to capture its
output and/or errput; it should do this specifically if the output and
errput is piped (and not, say, directed to a file). In preparation for
this change, add bools to io_streams_t which track whether stdout and
stderr are specifically piped.
2020-04-28 09:59:55 -07:00
David Adam
96b09a321d Merge branch 'Integration_3.1.1' 2020-04-28 19:35:46 +08:00
George Christou
2bc4228d42 edit_command_buffer: Add line:col support for Sublime Text 2020-04-28 08:48:31 +02:00
David Adam
b2fa5de54d Release 3.1.1 2020-04-27 21:57:43 +08:00
David Adam
3276d656cb CHANGELOG: errata for 3.1
Closes #6634.
2020-04-27 21:50:39 +08:00
ridiculousfish
9949c39d70 Relnote 3.1.1 fixes for #6624 and #6806 2020-04-26 15:54:18 -07:00
ridiculousfish
ed8e7b934f Merge branch 'cmdsub_inherit_pgroup_3.1.1' into Integration_3.1.1
This merges three fixes around propagating pgroups, and preventing pipe
deadlock. This is equivalent to the merge at
c034c2c99b, but for 3.1.1
2020-04-26 15:41:30 -07:00
ridiculousfish
5fccfd83ec builtin_eval to direct output to its iostreams
Prior to this fix, builtin_eval would direct output to the io_chain of the
job. The problem is with pipes: `builtin_eval` might happily attempt to
write unlimited output to the write end of a pipe, but the corresponding
reading process has not yet been launched. This results in deadlock.

The fix is to buffer all the output from `builtin_eval`. This is not fun
but the best that can be done until we have real concurrent processes.

cherry-pick of a1f1b9c2d9

Fixes #6806
2020-04-26 15:40:22 -07:00
ridiculousfish
de180689e4 Thread pgroups into builtin_eval
Ensure that if eval is invoked as part of a pipeline, any jobs spawned
by eval will have the same pgroup as the parent job.

cherry-pick of 82f2d86718

Partially fixes #6806
2020-04-26 15:40:22 -07:00
ridiculousfish
2d3c914a9d Thread pgroups into command substitutions
Give string expansion an (optional) parent pgroup. This is threaded all
the way into eval(). This ensures that in a mixed pipeline like:

   cmd | begin ; something (cmd2) ; end

that cmd2 and cmd have the same pgroup.

Add a test to ensure that command substitutions inherit pgroups
properly.

cherry-pick of 938b683895

Fixes #6624
2020-04-26 15:40:22 -07:00