summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-02-12 01:16:40 -0500
committerJune McEnroe <june@causal.agency>2020-02-12 01:16:40 -0500
commit14ae13f781d1ab30d648eaffbace67a9eec36c5b (patch)
treee9d3c451cddf8c35cfd6c6d5e44e0cd32180c184
parentAdd C-v and M-v (diff)
downloadcatgirl-14ae13f781d1ab30d648eaffbace67a9eec36c5b.tar.gz
catgirl-14ae13f781d1ab30d648eaffbace67a9eec36c5b.zip
Add C-t transpose
Also in emacs, weechat.
-rw-r--r--catgirl.12
-rw-r--r--chat.h1
-rw-r--r--edit.c9
-rw-r--r--ui.c3
4 files changed, 14 insertions, 1 deletions
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);
 	}
 }
to cgitrc (as opposed to parsing something like /etc/mime.types) is to allow quick lookup of a limited number of filename extensions (/etc/mime-types on my machine currently contains over 700 entries). NB: A nice addition to this patch would be to parse /etc/mime.types when `plain` view is requested for a file with an extension for which there is no mapping registered in cgitrc. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25cgit.h: keep config flags sortedLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25cgitrc.5.txt: document 'embedded' and 'noheader'Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25Add support for 'noheader' optionLars Hjemli This option can be used to disable the standard cgit page header, which might be useful in combination with the 'embedded' option. Suggested-by: Mark Constable <markc@renta.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25cgitrc.5.txt: document 'head-include'Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25ui-blob: return 'application/octet-stream' for binary blobsLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-07-25ui-plain: Return 'application/octet-stream' for binary files.Remko Tronçon Signed-off-by: Remko Tronçon <git@el-tramo.be> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-06-11use cgit_httpscheme() for atom feedDiego Ongaro 2009-06-11add cgit_httpscheme() -> http:// or https://Diego Ongaro 2009-06-07Return http statuscode 404 on unknown branchLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-06-07Add head-include configuration option.Mark Lodato This patch adds an option to the configuration file, "head-include", which works just like "header" or "footer", except the content is put into the HTML's <head> tag. 2009-03-15CGIT 0.8.2.1Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15Fix doc-related glitches in Makefile and .gitignoreLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15ui-snapshot: avoid segfault when no filename is specifiedLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-03-15fix segfault when displaying empty blobsEric Wong When size is zero, subtracting one from it turns it into ULONG_MAX which causes an out-of-bounds access on buf. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-19Add support for HEAD requestsLars Hjemli This is a quick 'n dirty hack which makes cgit honor HEAD requests. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-19Add support for ETag in 'plain' viewLars Hjemli When downloading a blob identified by its path, the client might want to know if the blob has been modified since a previous download of the same path. To this end, an ETag containing the blob SHA1 seems to be ideal. Todo: add support for HEAD requests... Suggested-by: Owen Taylor <otaylor@redhat.com> Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-12ui-tree: escape ascii-text properly in hexdump viewLars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2009-02-12Makefile: add doc-related targetsLars Hjemli