mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-26 10:43:47 +08:00
Fix to prevent buff_pos from underflowing in reader_kill
This commit is contained in:
parent
51de26960c
commit
3d5a3f03fa
|
@ -494,7 +494,9 @@ static void reader_kill( size_t begin_idx, size_t length, int mode, int newv )
|
|||
}
|
||||
|
||||
if( data->buff_pos > begin_idx ) {
|
||||
data->buff_pos = maxi( begin_idx, data->buff_pos-length );
|
||||
/* Move the buff position back by the number of characters we deleted, but don't go past buff_pos */
|
||||
size_t backtrack = mini(data->buff_pos - begin_idx, length);
|
||||
data->buff_pos -= backtrack;
|
||||
}
|
||||
|
||||
data->command_line.erase(begin_idx, length);
|
||||
|
|
Loading…
Reference in New Issue
Block a user