Simplify transpose swap

weechat-hashes
C. McEnroe 2020-02-12 01:19:07 -05:00
parent 14ae13f781
commit 456713e561
1 changed files with 3 additions and 4 deletions

7
edit.c
View File

@ -185,10 +185,9 @@ void edit(size_t id, enum Edit op, wchar_t ch) {
break; case EditTranspose: { break; case EditTranspose: {
if (!pos || len < 2) break; if (!pos || len < 2) break;
if (pos == len) pos--; if (pos == len) pos--;
wchar_t t = buf[pos]; wchar_t t = buf[pos - 1];
buf[pos] = buf[pos - 1]; buf[pos - 1] = buf[pos];
buf[pos - 1] = t; buf[pos++] = t;
pos++;
} }
break; case EditInsert: { break; case EditInsert: {