From 03e36bda720874f2383d692035eaa6f67bd5517e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Rish=C3=B8j?= Date: Wed, 29 May 2013 11:48:04 +0200 Subject: [PATCH] make cursor placement consistent with `transpose-words` from readline --- reader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/reader.cpp b/reader.cpp index da4a6e003..c7e247900 100644 --- a/reader.cpp +++ b/reader.cpp @@ -3555,7 +3555,6 @@ const wchar_t *reader_readline(void) case R_TRANSPOSE_WORDS: { - size_t orig_pos = data->buff_pos; size_t len = data->command_length(); const wchar_t *buff = data->command_line.c_str(); const wchar_t *tok_begin, *tok_end, *prev_begin, *prev_end; @@ -3588,7 +3587,8 @@ const wchar_t *reader_readline(void) new_buff.append(sep); new_buff.append(prev); new_buff.append(trail); - set_command_line_and_position(new_buff, orig_pos); + /* Put cursor right after the second token */ + set_command_line_and_position(new_buff, tok_end - buff); } break; }