mirror of
https://github.com/nushell/nushell
synced 2025-01-13 13:49:21 +00:00
Fix span of multibyte short flags (#8866)
# Description Follow up to #8849 Work for #8821 Should unblock work on #8808 Missing is a restriction to printables or identifiers according to [UAX31](https://www.unicode.org/reports/tr31/) # User-Facing Changes Non ASCII characters should be allowed in shortflags. # Tests + Formatting Want to add some tests for the error reporting cases
This commit is contained in:
parent
8efbb48cb0
commit
6cedc05384
1 changed files with 2 additions and 2 deletions
|
@ -457,12 +457,12 @@ fn parse_short_flags(
|
|||
let short_flags = &arg_contents_uft8_ref[1..];
|
||||
let mut found_short_flags = vec![];
|
||||
let mut unmatched_short_flags = vec![];
|
||||
for short_flag in short_flags.chars().enumerate() {
|
||||
for short_flag in short_flags.char_indices() {
|
||||
let short_flag_char = short_flag.1;
|
||||
let orig = arg_span;
|
||||
let short_flag_span = Span::new(
|
||||
orig.start + 1 + short_flag.0,
|
||||
orig.start + 1 + short_flag.0 + 1,
|
||||
orig.start + 1 + short_flag.0 + short_flag_char.len_utf8(),
|
||||
);
|
||||
if let Some(flag) = sig.get_short_flag(short_flag_char) {
|
||||
// If we require an arg and are in a batch of short flags, error
|
||||
|
|
Loading…
Reference in a new issue