From 14ae13f781d1ab30d648eaffbace67a9eec36c5b Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Wed, 12 Feb 2020 01:16:40 -0500 Subject: Add C-t transpose Also in emacs, weechat. --- edit.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'edit.c') diff --git a/edit.c b/edit.c index d90d558..573e549 100644 --- a/edit.c +++ b/edit.c @@ -182,6 +182,15 @@ 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++; + } + break; case EditInsert: { if (reserve(pos, 1)) { buf[pos++] = ch; -- cgit 1.4.1-2-gfad0