Commit Graph

10022 Commits

Author SHA1 Message Date
Fabian Homborg
c633c06e11 Guess emoji width via system wcwidth
Since Unicode 9, the width of some characters changed to 2.

Depending on the system, it might have support for it, or it might
not.

Instead of hardcoding specific glibc etc versions, we check what the
system wcwidth says to "😃", U+1F603 "Grinning Face With Big Eyes".

The intention is to, in most cases, make setting $fish_emoji_width
unnecessary, but since it sets the "guessed_emoji_width", that variable still takes precedence if it is set.

Unfortunately this approach has some caveats:

- It relies on the locale being set to a unicode-supporting one.
  (C.UTF-8 is unfortunately not standard, so we can't use it)
- It relies on the terminal's wcwidth having unicode9 support IFF the
  system wcwidth does.

This is like #5722, but at runtime.

The additional caveat is that we don't try to achieve a unicode
locale, but since we re-run the heuristic when the locale changes (and
we try to get a unicode locale), we should still often get the correct
value.

Plus if you use a C locale and your terminal still displays emoji,
you've misconfigured your system.

Fixes #5722.
2019-03-06 22:27:21 +01:00
Fabian Homborg
60ce10ad84 functions/eval: Return 0 for empty arguments
Fixes #5692.
2019-03-05 21:10:11 +01:00
Fabian Homborg
eac9ec9093 Add vagrant completions
These aren't perfect, but the tool is pretty much hostile to proper
completions - it includes a "--machine-readable" option, but `vagrant
global-status --machine-readable` prints great output like

```
1551816037,,ui,info,id
1551816037,,ui,info,name
1551816037,,ui,info,provider
1551816037,,ui,info,state
1551816037,,ui,info,directory
1551816037,,ui,info,
1551816037,,ui,info,-------------------------------------------------------------------------
1551816037,,ui,info,d3ea265
1551816037,,ui,info,default
1551816037,,ui,info,virtualbox
1551816037,,ui,info,poweroff
1551816037,,ui,info,/home/alfa/dev/oi-userland
1551816037,,ui,info,
1551816037,,ui,info,fdf42c4
1551816037,,ui,info,default
1551816037,,ui,info,virtualbox
1551816037,,ui,info,poweroff
1551816037,,ui,info,/home/alfa/dev/vagrant/NetBSD
1551816037,,ui,info,
1551816037,,ui,info,f8f6eff
1551816037,,ui,info,default
1551816037,,ui,info,virtualbox
1551816037,,ui,info,poweroff
1551816037,,ui,info,/home/alfa/dev/vagrant/fedora
1551816037,,ui,info,
1551816037,,ui,info, \nThe above shows information about all known Vagrant environments\non this machine. This data is cached and may not be completely\nup-to-date (use "vagrant global-status --prune" to prune invalid\nentries). To interact with any of the machines%!(VAGRANT_COMMA) you can go to that\ndirectory and run Vagrant%!(VAGRANT_COMMA) or you can use the ID directly with\nVagrant commands from any directory. For example:\n"vagrant destroy 1a2b3c4d"
```

and still takes 500ms to do so. The actual information is in a json
file, which we can't expect to read, and it doesn't have linebreaks or
such which we could use to hack-parse it.

So this is the best we can do for the most important bits (the
machineids), so let's just add this as-is.

[ci skip]
2019-03-05 21:02:32 +01:00
zabereer
a634356bcc remove redundant comment from __fish_print_pipestatus.fish 2019-03-05 18:25:16 +00:00
zabereer
d71e39f756 Revert "use global variables for $pipestatus in prompts to allow users to customize the look"
This reverts commit d5c18350a7.
2019-03-05 18:19:57 +00:00
Fabian Homborg
60f162db19 Remove single-argument test
This is an awful bit of `test` functionality that only exists to have
a clever shortcut and confuse people.

[ci skip]
2019-03-05 17:57:50 +01:00
Fabian Homborg
fe029d4d27 CHANGELOG: Remove reverted fix for read in fish_title
11009de431 reverted
b247c8d9ad because it did not work.

[ci skip]
2019-03-05 10:44:11 +01:00
David Adam
b443808452 event.cpp: die if invalid event type passed
Fixes the build with -Wreturn-type.
2019-03-05 07:27:56 +08:00
zabereer
da2925bad7 add $pipestatus to classic_vcs.fish prompt 2019-03-04 18:25:18 +00:00
zabereer
0923712e3e add $pipestatus to informative_vcs.fish prompt 2019-03-04 18:15:04 +00:00
David Adam
08fd8b6472 cmake: fix prebuilt documentation detection and installation 2019-03-04 22:06:09 +08:00
ridiculousfish
89a7cc5da3 Switch s_write to accepting const vector & instead of raw pointers 2019-03-03 18:49:57 -08:00
ridiculousfish
ccbc9d57f2 Remove reader_data_t::next
It's no longer used
2019-03-03 18:14:41 -08:00
ridiculousfish
9b9c1aa745 Fix some unused variable warnings 2019-03-03 18:06:31 -08:00
ridiculousfish
717ac9a8d5 Switch highlight_spec_t to a struct
Rather than a janky bitmask, use a real struct with real fields.
2019-03-03 18:04:22 -08:00
ridiculousfish
d165d1df27 Remove highlight_modifier_sloppy_background
It's no longer ever set
2019-03-03 17:56:08 -08:00
ridiculousfish
43a11af5e4 Reorganize reader.cpp to separate te current_data users from reader_data_t 2019-03-03 15:49:56 -08:00
ridiculousfish
c09544b288 Migrate more functions to instance methods on reader_data_t 2019-03-03 15:10:47 -08:00
ridiculousfish
29db076f4a exec_prompt to be an instance method on reader_data_t 2019-03-03 14:38:53 -08:00
ridiculousfish
7ff4b5e5fe Switch highlighting to instance methods on reader_data_t 2019-03-03 14:34:52 -08:00
ridiculousfish
e477b99a8b Switch more autosuggestions to instance methods on reader_data_t 2019-03-03 14:30:32 -08:00
ridiculousfish
b014c327a2 reader_data_t to become enable_shared_from_this
For background operations such as autosuggestions, we need a way for the
completion handler to keep the reader_data alive.
2019-03-03 14:21:15 -08:00
ridiculousfish
c334a41f96 Switch accept_autosuggestion to an instance method on reader_data_t 2019-03-03 14:11:09 -08:00
ridiculousfish
d7a156e7d9 Switch clear_pager to an instance method on reader_data_t 2019-03-03 14:09:23 -08:00
ridiculousfish
164c5b1c18 Migrate a lot of free functions in reader into reader_data_t 2019-03-03 14:02:27 -08:00
ridiculousfish
ecf51b575e Clean up input initialization and destruction 2019-03-03 12:59:55 -08:00
ridiculousfish
dc1073f905 reader_set_buffer_maintaining_pager to take reader_data directly 2019-03-03 12:19:46 -08:00
ridiculousfish
0bc08c6197 highlight_search to take reader_data directly 2019-03-03 12:11:32 -08:00
ridiculousfish
b07345ed18 set_command_line_and_position to take reader_data directly 2019-03-03 12:07:51 -08:00
ridiculousfish
968152ddc7 clear_pager to accept reader_data directly 2019-03-03 12:00:09 -08:00
ridiculousfish
e11c3f352f Clean up handle_child_status
Now that we only call waitpid() on specific processes, we no longer need
to search to find the process returned by waitpid.
2019-03-03 11:47:32 -08:00
radek-sprta
261d48367d Add completions for Mariner (#5718)
* Add completions for Mariner

* Remove unnecessary characters
2019-03-03 20:25:31 +01:00
Fabian Homborg
8939a7ba7a completions/ipset: Don't error on loading
`ipset list --name` is a privileged operation, and it prints an
"Operation not permitted" error when done as a normal user.

What's worse, this did it on loading (the command substitution wasn't
quoted), so we'd print the error as soon as you did `ipset `.

Only do the operation when necessary, and don't print the error.

This'll effectively only make it work for root shells (not e.g. `sudo
ipset`), but I don't want to sprinkle `sudo` in the completion.

(Also why does listing stuff require root? That's not how it works
e.g. for ips. But I don't actually know what ipset is for, so maybe
there is a good reason.)

[ci skip]
2019-03-03 12:43:05 +01:00
ridiculousfish
dac5d79059 Switch wait command to use topics
Prior to this fix, the wait command used waitpid() directly. Switch it to
calling process_mark_finished_children() along with the rest of the job
machinery. This centralizes the waitpid call to a single location.
2019-03-02 16:58:27 -08:00
ridiculousfish
dc27de8190 Rename reader_interrupted to reader_test_and_clear_interrupted 2019-03-02 15:17:00 -08:00
zabereer
d5c18350a7 use global variables for $pipestatus in prompts to allow users to customize the look 2019-03-01 19:55:28 +00:00
David Adam
637503cb0a travis: drop superfluous CXXFLAGS on macOS
These have not been required since ASan was moved back to the Linux build.
2019-02-28 21:09:03 +08:00
David Adam
83b4adffc0 make_pkg: get static version if git is not available 2019-02-28 21:08:02 +08:00
David Adam
73d9f80772 cmake: drop obsolete paths for prebuilt documentation 2019-02-28 22:04:54 +11:00
David Adam
9acfe0261b cmake: install system manpath manpages
The build path of these files moved under Sphinx.
2019-02-28 22:03:57 +11:00
David Adam
d0394fd301 configure/Makefile.in: drop Autotools build
Removes the autoconf-based build system and its artefacts, updates git metadata and removes the
autoconf-based build from the README.
2019-02-28 22:03:57 +11:00
David Adam
44bb098404 Dockerfile: move to CMake 2019-02-28 22:03:57 +11:00
David Adam
fe79badaef Travis: move all builds to CMake 2019-02-28 22:03:57 +11:00
David Adam
f5f6e5307d cmake: add lint/lint-all targets 2019-02-28 22:03:57 +11:00
David Adam
ba64ec6e91 lint: drop CXX argument
The "fatal error: 'stddef.h' file not found" error is caused by incomplete installation of IWYU,
which can be fixed directly.

See https://github.com/include-what-you-use/include-what-you-use/issues/100
2019-02-28 22:03:57 +11:00
David Adam
a0f785c90f build_tools/style: drop guidance to use make 2019-02-28 22:03:57 +11:00
David Adam
e9b853e0c2 make_tarball: use cmake instead of Autotools for doc generation 2019-02-28 22:03:56 +11:00
zabereer
e157ba131b add $pipestatus to informative.fish prompt 2019-02-28 06:37:56 +00:00
zabereer
ead26881f0 create __fish_print_pipestatus function to reduce code duplication in other prompts when adding $pipestatus 2019-02-28 06:19:28 +00:00
zabereer
8ebbe67ff1 Use string match instead of for loop to simplify classic_status.fish 2019-02-27 06:11:03 +00:00