summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-12 01:19:07 -0500
committerJune McEnroe <june@causal.agency>2020-02-12 01:19:07 -0500
commit456713e561b73ecfeb0d84d9afff2f3a8cd91cbb (patch)
tree5febd8532fd17fccd0630ff8469a5fae1216c9d1
parentAdd C-t transpose (diff)
downloadcatgirl-456713e561b73ecfeb0d84d9afff2f3a8cd91cbb.tar.gz
catgirl-456713e561b73ecfeb0d84d9afff2f3a8cd91cbb.zip
Simplify transpose swap
-rw-r--r--edit.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/edit.c b/edit.c
index 573e549..1f8f170 100644
--- a/edit.c
+++ b/edit.c
@@ -185,10 +185,9 @@ void edit(size_t id, enum Edit op, wchar_t ch) {
 		break; case EditTranspose: {
 			if (!pos || len < 2) break;
 			if (pos == len) pos--;
-			wchar_t t = buf[pos];
-			buf[pos] = buf[pos - 1];
-			buf[pos - 1] = t;
-			pos++;
+			wchar_t t = buf[pos - 1];
+			buf[pos - 1] = buf[pos];
+			buf[pos++] = t;
 		}
 
 		break; case EditInsert: {