mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-04 09:08:46 +00:00
Fix selection going out of bounds
Which happened when starting the selection at the end of the commandline.
In this case, selections still interact weirdly with autosuggestions (the
first character of the suggestion appears to be part of the selection
when it's not).
Fixes #6680
(cherry-picked from commit 99851c09b3
)
This commit is contained in:
parent
764420f272
commit
e6248cf7be
1 changed files with 1 additions and 1 deletions
|
@ -3477,7 +3477,7 @@ bool reader_get_selection(size_t *start, size_t *len) {
|
|||
reader_data_t *data = current_data_or_null();
|
||||
if (data != nullptr && data->sel_active) {
|
||||
*start = data->sel_start_pos;
|
||||
*len = std::min(data->sel_stop_pos - data->sel_start_pos, data->command_line.size());
|
||||
*len = std::min(data->sel_stop_pos, data->command_line.size()) - data->sel_start_pos;
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue