mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
Fix issue where transpose fails if there is a trailing autosuggestion
This commit is contained in:
parent
f32dfe2da6
commit
ee95a7309a
1 changed files with 6 additions and 7 deletions
13
reader.cpp
13
reader.cpp
|
@ -3043,7 +3043,7 @@ const wchar_t *reader_readline(void)
|
|||
else
|
||||
{
|
||||
/* Either the user hit tab only once, or we had no visible completion list. */
|
||||
|
||||
|
||||
/* Remove a trailing backslash. This may trigger an extra repaint, but this is rare. */
|
||||
if (is_backslashed(data->command_line, data->buff_pos))
|
||||
{
|
||||
|
@ -3544,7 +3544,8 @@ const wchar_t *reader_readline(void)
|
|||
|
||||
case R_TRANSPOSE_CHARS:
|
||||
{
|
||||
if (data->command_length() < 2) {
|
||||
if (data->command_length() < 2)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -3560,11 +3561,9 @@ const wchar_t *reader_readline(void)
|
|||
*/
|
||||
if (data->buff_pos > 0)
|
||||
{
|
||||
wchar_t tmp = data->command_line[data->buff_pos];
|
||||
data->command_line[data->buff_pos] = data->command_line[data->buff_pos-1];
|
||||
data->command_line[data->buff_pos-1] = tmp;
|
||||
data->buff_pos++;
|
||||
reader_repaint();
|
||||
wcstring local_cmd = data->command_line;
|
||||
std::swap(local_cmd.at(data->buff_pos), local_cmd.at(data->buff_pos-1));
|
||||
set_command_line_and_position(local_cmd, data->buff_pos + 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue