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. --- catgirl.1 | 2 ++ chat.h | 1 + edit.c | 9 +++++++++ ui.c | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/catgirl.1 b/catgirl.1 index ad62f83..518f830 100644 --- a/catgirl.1 +++ b/catgirl.1 @@ -265,6 +265,8 @@ Move to end of line. Move right. .It Ic C-k Delete to end of line. +.It Ic C-t +Transpose characters. .It Ic C-u Delete to beginning of line. .It Ic C-w diff --git a/chat.h b/chat.h index 4e9a230..aa2f87c 100644 --- a/chat.h +++ b/chat.h @@ -176,6 +176,7 @@ enum Edit { EditDeletePrevWord, EditDeleteNextWord, EditPaste, + EditTranspose, EditInsert, EditComplete, EditEnter, 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; diff --git a/ui.c b/ui.c index 328db1b..e6041cc 100644 --- a/ui.c +++ b/ui.c @@ -844,9 +844,10 @@ static void keyCtrl(wchar_t ch) { break; case L'N': windowShow(windows.active->next); break; case L'O': windowShow(windows.other); break; case L'P': windowShow(windows.active->prev); + break; case L'T': edit(id, EditTranspose, 0); break; case L'U': edit(id, EditDeleteHead, 0); - break; case L'W': edit(id, EditDeletePrevWord, 0); break; case L'V': windowScroll(windows.active, -(PAGE_LINES - 2)); + break; case L'W': edit(id, EditDeletePrevWord, 0); break; case L'Y': edit(id, EditPaste, 0); } } -- cgit 1.4.1 '/>
path: root/doc/zlib/inflateInit2.3 (unfollow)
Commit message (Expand)Author
2021-01-31Add The Rosewater RedemptionJune McEnroe
2021-01-29Use int when checking for EOFJune McEnroe
2021-01-28Move gpl.c and agpl.c templates out of etcJune McEnroe
2021-01-27Set para and sect for mdocJune McEnroe
2021-01-26Use First state to match keyword at beginning of lineJune McEnroe
2021-01-25Install vi on Linux and nvi on macOSJune McEnroe
2021-01-25Use vi and lessJune McEnroe
2021-01-20Use mtags for sh in source-filterJune McEnroe
2021-01-20Generate tags for sh files in mtagsJune McEnroe
2021-01-20Add messy sh lexerJune McEnroe
2021-01-20Add all target to git.causal.agency MakefileJune McEnroe
2021-01-20Remove Lua supportJune McEnroe
2021-01-20Fix tests for diff spansJune McEnroe
2021-01-20Avoid matching ':' in make tagsJune McEnroe
2021-01-19Prefer tag matches not preceded by [[:alnum:]]June McEnroe
2021-01-19Escape \ and / in mtags search patternsJune McEnroe
2021-01-20Use mtags in source-filterJune McEnroe
2021-01-19Add mtags to generate tags for make and mdocJune McEnroe
2021-01-19Map tags to IDs using only [[:alnum:]-._]June McEnroe
2021-01-19Don't use a pager if reading standard inputJune McEnroe
2021-01-19Support BSD make syntax and match *.amJune McEnroe
2021-01-19Match tab following escaped newline in make assignmentsJune McEnroe
2021-01-18Allow matching lexers using first input lineJune McEnroe