summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-03 14:40:23 -0400
committerJune McEnroe <june@causal.agency>2019-10-03 14:40:23 -0400
commite7bfdb237612072506938d5ae7578f7c1fd4cbff (patch)
tree8670b7a30758d7f90b88bb1b23503fd14f044517
parentRemove -W WEBIRC option (diff)
downloadcatgirl-e7bfdb237612072506938d5ae7578f7c1fd4cbff.tar.gz
catgirl-e7bfdb237612072506938d5ae7578f7c1fd4cbff.zip
Add C-u and move underline to C-_
-rw-r--r--catgirl.18
-rw-r--r--chat.h3
-rw-r--r--edit.c3
-rw-r--r--ui.c5
4 files changed, 12 insertions, 7 deletions
diff --git a/catgirl.1 b/catgirl.1
index f0f1422..5511ed4 100644
--- a/catgirl.1
+++ b/catgirl.1
@@ -1,4 +1,4 @@
-.Dd September 16, 2019
+.Dd October 3, 2019
 .Dt CATGIRL 1
 .Os
 .
@@ -254,6 +254,8 @@ Move cursor to end of line.
 Move cursor right.
 .It Ic C-k
 Delete line after cursor.
+.It Ic C-u
+Delete line.
 .It Ic C-w
 Delete word before cursor.
 .It Ic M-b
@@ -269,6 +271,8 @@ commands, nicks and channels.
 .
 .Ss IRC Formatting
 .Bl -tag -width Ds -compact
+.It Ic C-_
+Toggle underline.
 .It Ic C-o
 Toggle bold.
 .It Ic C-r
@@ -277,8 +281,6 @@ Set or reset color.
 Reset formatting.
 .It Ic C-t
 Toggle italics.
-.It Ic C-u
-Toggle underline.
 .It Ic C-v
 Toggle reverse video.
 This must usually be typed as
diff --git a/chat.h b/chat.h
index e33ea2f..61d8a96 100644
--- a/chat.h
+++ b/chat.h
@@ -165,9 +165,10 @@ enum Edit {
 	EditInsert,
 	EditBackspace,
 	EditDelete,
+	EditKill,
 	EditKillBackWord,
 	EditKillForeWord,
-	EditKillLine,
+	EditKillEnd,
 	EditComplete,
 	EditEnter,
 };
diff --git a/edit.c b/edit.c
index 99dc929..c63e4a2 100644
--- a/edit.c
+++ b/edit.c
@@ -172,9 +172,10 @@ void edit(struct Tag tag, enum Edit op, wchar_t ch) {
 		break; case EditBackspace: reject(); backspace();
 		break; case EditDelete:    reject(); delete();
 
+		break; case EditKill:         reject(); line.ptr = line.end = line.buf;
 		break; case EditKillBackWord: reject(); killBackWord();
 		break; case EditKillForeWord: reject(); killForeWord();
-		break; case EditKillLine:     reject(); line.end = line.ptr;
+		break; case EditKillEnd:      reject(); line.end = line.ptr;
 
 		break; case EditComplete: complete(tag);
 
diff --git a/ui.c b/ui.c
index 1273028..9cf21d3 100644
--- a/ui.c
+++ b/ui.c
@@ -515,7 +515,8 @@ static void keyChar(wchar_t ch) {
 		break; case CTRL(L'D'): edit(win->tag, EditDelete, 0);
 		break; case CTRL(L'E'): edit(win->tag, EditEnd, 0);
 		break; case CTRL(L'F'): edit(win->tag, EditRight, 0);
-		break; case CTRL(L'K'): edit(win->tag, EditKillLine, 0);
+		break; case CTRL(L'K'): edit(win->tag, EditKillEnd, 0);
+		break; case CTRL(L'U'): edit(win->tag, EditKill, 0);
 		break; case CTRL(L'W'): edit(win->tag, EditKillBackWord, 0);
 
 		break; case CTRL(L'C'): edit(win->tag, EditInsert, IRCColor);
@@ -523,8 +524,8 @@ static void keyChar(wchar_t ch) {
 		break; case CTRL(L'R'): edit(win->tag, EditInsert, IRCColor);
 		break; case CTRL(L'S'): edit(win->tag, EditInsert, IRCReset);
 		break; case CTRL(L'T'): edit(win->tag, EditInsert, IRCItalic);
-		break; case CTRL(L'U'): edit(win->tag, EditInsert, IRCUnderline);
 		break; case CTRL(L'V'): edit(win->tag, EditInsert, IRCReverse);
+		break; case CTRL(L'_'): edit(win->tag, EditInsert, IRCUnderline);
 
 		break; case L'\b': edit(win->tag, EditBackspace, 0);
 		break; case L'\t': edit(win->tag, EditComplete, 0);
a&id=a2a118c85792f7da85630a07d343ad49204e8ae6&follow=1'>Fix edit.[ch] license notice additional permissionsJune McEnroe 2022-02-19Run line editing testsJune McEnroe I know, it feels wrong. 2022-02-18Implement new line editing "library"June McEnroe Losing tab complete and text macros, for now. This new implementation works on an instance of a struct and does not interact with the rest of catgirl, making it possible to copy into another project. Unlike existing line editing libraries, this one is entirely abstract and can be rendered externally. My goal with this library is to be able to implement vi mode. Since it operates on struct instances rather than globals, it might also be possible to give catgirl separate line editing buffers for each window, which would be a nice UX improvement. 2022-02-18Simplify cursor positioning in inputJune McEnroe Do some extra work by adding the portion before the cursor to the input window twice, but simplify the interaction with the split point. This fixes the awkward behaviour when moving the cursor across colour codes where the code would be partially interpreted up to the cursor. 2022-02-18Fix M-f orderingJune McEnroe 2022-02-12Move sandman build to scripts/MakefileJune McEnroe 2022-02-12Use compat_readpassphrase.c on LinuxJune McEnroe 2022-02-12Copy RPP defines from oconfigureJune McEnroe