mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 03:50:24 +08:00
parent
7c173c4b45
commit
947883c842
@ -517,7 +517,7 @@ pub fn commandline(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr])
|
|||||||
if cursor_mode {
|
if cursor_mode {
|
||||||
if positional_args != 0 {
|
if positional_args != 0 {
|
||||||
let arg = w.argv[w.woptind];
|
let arg = w.argv[w.woptind];
|
||||||
let new_pos = match fish_wcstol(&arg[range.start..]) {
|
let new_pos = match fish_wcstol(arg) {
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
streams
|
streams
|
||||||
.err
|
.err
|
||||||
@ -528,7 +528,8 @@ pub fn commandline(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr])
|
|||||||
Ok(num) => num,
|
Ok(num) => num,
|
||||||
};
|
};
|
||||||
|
|
||||||
let new_pos = std::cmp::min(new_pos.max(0) as usize, current_buffer.len());
|
let new_pos =
|
||||||
|
std::cmp::min(new_pos.max(0) as usize + range.start, current_buffer.len());
|
||||||
commandline_set_buffer(current_buffer.to_owned(), Some(new_pos));
|
commandline_set_buffer(current_buffer.to_owned(), Some(new_pos));
|
||||||
} else {
|
} else {
|
||||||
streams.out.append(sprintf!("%lu\n", current_cursor_pos));
|
streams.out.append(sprintf!("%lu\n", current_cursor_pos));
|
||||||
|
@ -21,3 +21,7 @@ or echo Invalid $status
|
|||||||
commandline --help &>/dev/null
|
commandline --help &>/dev/null
|
||||||
echo Help $status
|
echo Help $status
|
||||||
# CHECK: Help 0
|
# CHECK: Help 0
|
||||||
|
|
||||||
|
commandline -pC 0 --input "test | test"
|
||||||
|
echo $status
|
||||||
|
# CHECK: 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user