Johannes Altmanninger
b7638b50e4
common.rs: convenience function to convert to OsString
...
Even though we generally dont' want to use this type (because it's immutable),
it can be advantageous when working with the std::fs API. This is because
it implements "AsRef<Path>" which neither of CString and Vec<u8> do.
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
bfe68e6a83
common.rs: helper to convert from C-string of unknown length to wide
...
On the C++ side we have an overload that called std::wcslen(), this is the
equivalent one.
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
3163efb87f
Port most of fallback
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
1426d1bcb0
Port widecharwidth
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
8bbf663dee
common.rs: make some functions public
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
bff0caf1d8
common.rs: remove typedefs that have been ported to elsewhere
...
In general we should keep the existing structure, to minimize surprise.
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
8ae1ba3432
wutil: remove unused locale handling code that has been ported already
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
77ae80f842
wutil.cpp: remove unused function
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
d47590b864
proc.h: remove unused declaration
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
16ea4380c5
redirection.rs: don't leak FFI type into Rust code
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
807d1578c3
redirection.rs: make redirection spec fields public like in C++
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
11e16ef6df
env.rs: rename flags::EnvMode to EnvMode
...
The "flags" module was introduced when these where standalone constants.
Now that we define them as bitflags, we no longer need the extra namespace.
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
8e5adbf237
Use borrowing syntax instead of std::ptr::addr_of where possible
...
We usually don't need to cast; this looks simpler.
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
ed2b98dd9a
lib.rs: group common.rs before other modules, because it exports macros
...
This allows us to keep the next group sorted.
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
a848877e65
Remove an overload in io, to prepare for Rust
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
85ae1861fa
common.rs: fix leftover comment
2023-04-16 17:21:54 +02:00
Johannes Altmanninger
df6525e770
Make RustBuiltin a scoped enum
...
This prevents name clashes. It already is used as scoped enum.
2023-04-16 17:21:54 +02:00
Xiretza
61028f020c
cargo update
...
This fixes an issue with rust-analyzer always rebuilding even without changes,
which was introduced by b8189da011
.
2023-04-16 17:21:54 +02:00
Fabian Boehm
bf0ebd3967
Actually add builtin.rs
2023-04-16 11:41:41 +02:00
Fabian Boehm
72a32f1a12
Rewrite "builtin" builtin in Rust
...
This is very simple and basically a subset of type.
2023-04-16 11:30:31 +02:00
Fabian Boehm
b65a53a2a6
Rewrite "command" builtin in Rust
...
This is basically a subset of type, so we might as well.
To be clear this is `command -s` and friends, if you do `command grep` that's
handled as a keyword.
One issue here is that we can't get "one path or not" because I don't
know how to translate a maybe_t? Do we need to make it a shared_ptr instead?
2023-04-16 11:27:08 +02:00
Fabian Boehm
662a4740e2
Rewrite the type builtin in rust
2023-04-16 11:27:08 +02:00
Fabian Boehm
7c37b681b2
Expose out_is_redirected to rust
2023-04-16 11:27:08 +02:00
Fabian Boehm
d02d0f3309
highlight: Add colorize_shell wrapper
...
Since we don't reuse the vector anyway, this allows us to keep the
highlighting on the C++-side.
2023-04-16 11:27:08 +02:00
Fabian Boehm
31d65de26c
function: Add a bunch of awkward helper functions
...
This makes function_properties_ref_t not const, in order to work
around cxx
2023-04-16 11:27:08 +02:00
Fabian Boehm
d0c2d0c9cf
path: Add method to return wcstring_list_ffi_t
...
This is palatable to Cxx
2023-04-16 11:27:08 +02:00
ridiculousfish
15c8f08458
Eliminate to_rust_string_vec
...
This can just use wcstring_list_ffi_t now.
2023-04-15 18:15:37 -07:00
ridiculousfish
dee969bf3a
Introduce wcstring_list_ffi_t
...
wcstring_list_ffi_t is an autocxx-friendly type for passing lists of
strings from C++ to Rust.
2023-04-15 17:53:52 -07:00
Jan Tojnar
9e223577aa
Fix composer require
completion
...
When no development dependencies are installed, the completion would crash with:
KeyError: 'require-dev'
2023-04-12 21:05:23 +02:00
Paweł Piątkowski
bda9d57417
Ansible completion: fix typo in --limit-hosts
2023-04-12 16:52:13 +02:00
Johannes Altmanninger
9983c32a57
Port over builtin exit codes
...
They used to live in common.h but they are mostly used by builtins so I
grudgingly accept the early move.
2023-04-11 09:29:28 +02:00
Mahmoud Al-Qudsi
d728b884dd
Update pinned cxx dependency
...
Pulls in fish-shell/cxx 00536f3b771c9741bc325b37e7627d52052240a3 which
implements `VectorElement` for `CxxWString`.
2023-04-10 20:51:07 -05:00
Eric N. Vander Weele
fdd4bcf718
completions/git: Allow switch to complete remote branches
...
While it is true that `git switch <remote-branch>` errors to disallow a detached
head without the `-d` option, it is valid to use any starting point (commit or
reference) in conjunction with the `-c` option. Additionally, the starting point
can occur before any option.
This enables the following completions:
* `git switch -c <local-name> <any-branch>`
* `git switch <any-branch> -c <local-name>`
* `git switch -d <any-starting-point>`
* `git switch <any-branch> -d`
The trade-off is this does allow for `git switch <remote-branch>` to be
completed with an error.
Note that this logically reverts 7e3d3cc30f
.
2023-04-10 17:04:34 +02:00
AsukaMinato
8a0510a2f2
add qjs completion
2023-04-10 11:02:43 +02:00
AsukaMinato
36e4b0ff30
add completion for ar ( #9720 )
...
* add completion for ar
* clean the function
* update CHANGELOG
2023-04-10 11:01:47 +02:00
ridiculousfish
de24e84a48
Changelog fix for #9722
2023-04-09 11:34:45 -07:00
abp
bbe2a2ba9b
completions: Shortened descriptions
...
- Mainly work is done on gcc
- Some duplicated removed elsewhere
2023-04-09 11:33:23 -07:00
ridiculousfish
0ad3e3a45d
Changelog fix for #9717
2023-04-08 20:23:21 -07:00
Eric N. Vander Weele
4ed53d4e3f
reader: Apply fish_color_selection fg color and options in vi visual mode
...
Vi visual mode selection highlighting behaves unexpectedly when the selection
foreground and background in the highlight spec don't match. The following
unexpected behaviors are:
* The foreground color is not being applied when defined by the
`fish_color_selection` variable.
* `set_color` options (e.g., `--bold`) would not be applied under the cursor
when selection begins in the middle of the command line or when the cursor
moves forward after visually selecting text backward.
With this change, visual selection respects the foreground color and any
`set_color` options are applied consistently regardless of where visual
selection begins and the position of the cursor during selection.
2023-04-08 20:20:58 -07:00
ridiculousfish
169f90448a
Stop generating autoccx ffi wrappers for pcre2 regex
...
We have "native" FFI wrappers for these now via the pcre2 crate.
2023-04-08 19:05:08 -07:00
Andy Hall
6ff971e4c2
Fix typo in set
docs
2023-04-08 18:56:46 -07:00
Eric N. Vander Weele
a6e16a11c2
docs/interactive: Document fish_color_history_current variable
...
All *.theme files set variables documented in the "Syntax highlighting
variables" section, and fish_color_history_current was missing.
2023-04-07 15:29:23 +02:00
David Adam
733b981983
fish.spec/Debian packaging: add cargo dependency
2023-04-07 12:45:24 +08:00
David Adam
8c645186c0
fish.spec: replace tabs with spaces
2023-04-07 12:22:34 +08:00
ridiculousfish
a487b1ecf2
Revert "Revert "Implement builtin_printf in Rust""
...
This reverts commit 9f7e6a6cd1
.
Add additional fixes from code review.
2023-04-06 15:54:09 -07:00
ridiculousfish
2d6f752f6e
Revert "Add link-asan to RUSTFLAGS in CI"
...
This reverts commit 8bb1bb8ae1
.
2023-04-06 14:29:18 -07:00
ridiculousfish
14c5c94d01
Use hexponent to implement hex float parsing in wcstod
...
This teaches wcstod to parse hex floats like 0x1.5p3 via a forked
version of hexponent. This support is necessary for printf.
2023-04-06 14:29:18 -07:00
ridiculousfish
74104f76ad
wcstod() to skip leading whitespace
...
This matches the C implementation.
2023-04-06 14:29:18 -07:00
Fabian Boehm
79f8364bc7
docs/completions: Add a teensy bit more
...
This should really be expanded instead of just pointing at the example
2023-04-04 18:07:25 +02:00
Fabian Boehm
a6560a4ea8
docs/fish_add_path: Also clarify the examples
2023-04-04 17:55:10 +02:00