Commit Graph

17785 Commits

Author SHA1 Message Date
Johannes Altmanninger
b28521c3d5 Port fish_indent 2023-12-06 09:59:16 +01:00
Johannes Altmanninger
3842d03473 Reformat fish files 2023-12-06 09:33:05 +01:00
Johannes Altmanninger
57e96e791e Remove some deprecated code
rust-analyzer completions are good enough so we don't need these.
2023-12-06 09:19:36 +01:00
Johannes Altmanninger
e2a0e1652e Clean up some std::io calls 2023-12-06 08:59:52 +01:00
Johannes Altmanninger
f5712af132 Add printf!/eprintf! convenience wrappers around fprintf!
We often want to format and print a string to a fd, usually stdout/stderr.

In general we can't use "format!", "print!", "eprint!" etc. because they don't
know about our use of WString where we encode of invalid Unicode characters
in the private use area.

Instead we use "wwrite_to_fd()".
Since we unfortunately don't have a "wformat!()" yet, we use "sprintf!()"
to create a formatted wstring to pass to "wwrite_to_fd()".

Add "printf!" and "eprintf!" to stand in for "print!" and "eprint!".
For printing to files other than stdout and stderr, keep "fwprintf!" but
drop the "w" since our "sprintf!" always produces wide strings.

Replace "fputws" with "fprintf" though we could also use "wwrite_to_fd"
if performance matters.

Unlike std::io::stdout(), we don't use locking yet.

Remaining work:

- There are more places where we use \be?print(ln)?!
  Usually we print strings that are guaranteed to be valid UTF-8, but not
  always. We should probably make all of them respect our WString semantics
  but preferrably keep using the native Rust format strings (#9948).
- I think flog.rs currently uses String so it won't handle invalid Unicode
  characters. We should probably fix this as well.
2023-12-06 08:59:52 +01:00
Johannes Altmanninger
e88e7dbf7a Remove stale comment 2023-12-04 23:03:36 +01:00
Thomas Queiroz
a64324421f Port builtin ulimit
Closes #10121
2023-12-03 11:39:15 +01:00
Johannes Altmanninger
31ecc5e0f9 compat.rs: group declarations 2023-12-03 11:34:31 +01:00
Johannes Altmanninger
43e2d7b48c Port pager.cpp 2023-12-03 11:02:04 +01:00
Johannes Altmanninger
f7b5ebc79f screen: rename size() to len() 2023-12-03 11:02:04 +01:00
Johannes Altmanninger
fadf0f2e5b Port editable_line_t 2023-12-02 20:04:07 +01:00
Johannes Altmanninger
020b990c81 screen: remove unused lifetime parameter 2023-12-02 19:22:03 +01:00
Johannes Altmanninger
29ec464767 Remove obsolete cur_term() wrapper 2023-12-02 16:39:27 +01:00
Fabian Boehm
05b024c675 fixup! fmt
It seems my emacs integration broke
2023-12-01 18:17:07 +01:00
Fabian Boehm
fe9d1228e1 function: Fix a broken format string 2023-12-01 18:15:11 +01:00
Fabian Boehm
aa904f0304 Correct a formattting FLOG 2023-12-01 18:15:11 +01:00
Johannes Altmanninger
31ad182aa5 Port screen.cpp 2023-12-01 11:59:33 +01:00
Johannes Altmanninger
5f1499cd67 curses: terminfo numeric capabilities are unsigned 2023-12-01 11:59:33 +01:00
Johannes Altmanninger
18654b1872 build.rs: silence error output of compile checks
These compile checks are expected to produce compiler errors on some systems.
The errors show up when there is an unrelated error, this is probably quite
confusing so fix that. Should revisit this later.
2023-12-01 11:59:33 +01:00
Fabian Boehm
0aa08cf267 Make wgettext_fmt! require an argument *to* format
Like FLOGF!, this now needs at least one argument to format.

This avoids some issues with missing variables and broken format
strings - it is how I found 13ba5bd405 -
where disown had a format string, with two placeholders, but no
arguments to fill them with.

For use in e.g. macros, where it's otherwise hard to tell if we have
something to format or not, this adds a wgettext_maybe_fmt! version to
"maybe" format, if necessary.
2023-11-29 21:12:21 +01:00
Johannes Altmanninger
f57c5e3a5f history: remove bogus assertion crashing on empty history items
In LastC++11, an empty history item means we either reached the end of history,
or the item is actually empty. The second meaning is still true.  We never
append empty history items but the history file might have been modified.

Fixes #10129
2023-11-29 20:26:36 +01:00
Fabian Boehm
b23057ee61 fix fmt 2023-11-29 17:03:10 +01:00
Fabian Boehm
13ba5bd405 disown: Fix a format string
Missed in 77aeb6a2a8, this would crash otherwise.
2023-11-29 16:59:53 +01:00
ridiculousfish
9b54e243b1 Add FFI bindings to universal notifiers and adopt in input_common
This removes the C++ bits for universal notifiers.
2023-11-26 17:29:53 -08:00
ridiculousfish
acd0bf1a43 Migrate uvar notifier test helper into its own module
Reduce the amount of stuff in mod.rs
2023-11-26 17:29:48 -08:00
ridiculousfish
a950a8270d Create an inotify based universal notifier for Linux
Recall that universal notifiers are used to report changes to universal
variables to other shell instances. This adds a new strategy based on using
inotify to directly monitor the universal variables
file.

We have tried this in the past and abandoned it because it doesn't properly
work on some CI systems - let's try again.
2023-11-26 17:29:48 -08:00
ridiculousfish
38d198a83a Port macOS universal notifiers to Rust
This ports the notifyd-based universal notifier to Rust.
2023-11-26 17:29:48 -08:00
ridiculousfish
0f29e0de2f Remove extract_most_significant_digit
This is now unused.
2023-11-26 17:23:37 -08:00
ridiculousfish
99dfbaffb9 Remove an unreachable_code "allow" declaration
This is no longer necessary - all of the code is readable.
2023-11-26 17:23:02 -08:00
Alex Chan
ccc8308d41 Add a missing space after a comma 2023-11-26 22:44:54 +08:00
David Adam
f2f41c6eec drop unused functions and configure checks
Remove the following C++ functions/methods, which have no callers:

common.cpp:
- read_loop
- narrow_string_safe
- escape_string_for_double_quotes
- read_unquoted_escape
- format_size
- format_size_safe
- valid_func_name
- get_executable_path

env.cpp:
- env_stack_t::set_empty
- env_stack_t::set_argv

fallback.cpp:
- fish_mkstemp_cloexec
- flock

proc_util.cpp:
- parse_util_slice_length
- parse_util_argument_is_help

path.cpp:
- path_get_path
- path_as_implicit_cd
- path_apply_working_directory
- path_emit_config_directory_messages
- path_get_data_remoteness
- path_get_config_remoteness
- path_is_valid
- paths_are_same_file

wcstringutil.cpp:
- split_string_tok

wutil.cpp:
- wgetcwd
- wunlink
- wrealpath
- wrename
- file_id_for_path
- fish_wcstoull

Also drop unused configure checks/defines:
- HAVE_FLOCK
2023-11-26 22:35:51 +08:00
ridiculousfish
f773697bc1 Fix a clippy lint in ConstPointer 2023-11-25 19:12:14 -08:00
ridiculousfish
0f3d4b754f Fix some bogus unused import warnings 2023-11-25 19:12:11 -08:00
ridiculousfish
cf4f07b837 Correct a misseplling 2023-11-25 16:01:58 -08:00
Fabian Boehm
62b9a0f983 path: Keep metadata around for special permissions 2023-11-24 17:05:08 +01:00
Fabian Boehm
9d1c0da773 path: Reduce syscalls for special permissions
This

1. Skips access() if we only have "special" permissions like the owner
that need stat
2. Does the geteuid()/getegid() *once* outside of filter_path, if we
need it

In the extreme case of `path filter --perm user,group` it will remove
3 syscalls per file.
2023-11-24 17:05:08 +01:00
Yonas Yanfa
1c2440c3ac
Enable dynamic title in Rio and Foot terminals (#10115) 2023-11-24 17:04:50 +01:00
Christian Fersch
1980a22522
git completion: Handle aliases referencing other aliases (#9992) 2023-11-24 17:03:02 +01:00
Husam Harazi
3c814bf53d
Add wpctl completions (#10043)
* Add wpctl completions

* Reviewed comments
2023-11-24 16:59:01 +01:00
Asuka Minato
9f9accf203
Update tar.fish (#10079)
* Update tar.fish

* add more long options

* add more options
2023-11-24 16:58:32 +01:00
Fabian Boehm
21b5f6f163 docs: Fix markdown links 2023-11-22 18:42:34 +01:00
Fabian Boehm
ed489d0d52 Add __fish_anypager helper
This makes it easier to get *any pager* in the number of places we do.

Unfortunately:

1. It can't just execute the pager because that might block
2. We can't really set the necessary options for less here
   so they still need to be set outside.

This

Fixes #10074

by falling back to `cat` in that case. We could also decide to abort
instead of using a non-pager, but for history that's probably fine.
2023-11-20 17:16:35 +01:00
Fabian Boehm
6361362996
Replace some direct uses of libc with wrappers (#10090)
This removes some spurious unsafe blocks and makes usage a bit nicer
2023-11-19 20:07:24 +01:00
Fabian Boehm
45829804af tests: Skip job_summary under ASAN in CI 2023-11-19 19:46:05 +01:00
Nater0214
1a42c97f75 completions: add checkinstall 2023-11-19 09:42:37 -08:00
ridiculousfish
c1e4a447fd Remove C++ UTF-8 bits
These are no longer used.
2023-11-18 19:21:25 -08:00
ridiculousfish
a718852ad4 Fix a typo and suppress an annoying clippy lint 2023-11-18 19:03:23 -08:00
ridiculousfish
da646a38ba Remove some unnecessary widestrs 2023-11-18 19:03:23 -08:00
ridiculousfish
f0eaa516c0 Stop boxing ParseExecutionContext
This wasn't necessary - probably a holdover from using unique_ptr in C++.
2023-11-18 19:03:23 -08:00
ridiculousfish
89376d5fd0 Fix a clippy lint 2023-11-18 19:03:23 -08:00