Add M-q to collapse whitespace
parent
0bf49817f6
commit
e3f7362241
|
@ -1,4 +1,4 @@
|
||||||
.Dd April 6, 2020
|
.Dd April 7, 2020
|
||||||
.Dt CATGIRL 1
|
.Dt CATGIRL 1
|
||||||
.Os
|
.Os
|
||||||
.
|
.
|
||||||
|
@ -429,6 +429,8 @@ Move to previous word.
|
||||||
Delete next word.
|
Delete next word.
|
||||||
.It Ic M-f
|
.It Ic M-f
|
||||||
Move to next word.
|
Move to next word.
|
||||||
|
.It Ic M-q
|
||||||
|
Collapse all whitespace.
|
||||||
.It Ic Tab
|
.It Ic Tab
|
||||||
Complete nick, channel, command or macro.
|
Complete nick, channel, command or macro.
|
||||||
.El
|
.El
|
||||||
|
|
1
chat.h
1
chat.h
|
@ -234,6 +234,7 @@ enum Edit {
|
||||||
EditDeleteNextWord,
|
EditDeleteNextWord,
|
||||||
EditPaste,
|
EditPaste,
|
||||||
EditTranspose,
|
EditTranspose,
|
||||||
|
EditCollapse,
|
||||||
EditInsert,
|
EditInsert,
|
||||||
EditComplete,
|
EditComplete,
|
||||||
EditExpand,
|
EditExpand,
|
||||||
|
|
13
edit.c
13
edit.c
|
@ -232,6 +232,19 @@ void edit(uint id, enum Edit op, wchar_t ch) {
|
||||||
buf[pos - 1] = buf[pos];
|
buf[pos - 1] = buf[pos];
|
||||||
buf[pos++] = t;
|
buf[pos++] = t;
|
||||||
}
|
}
|
||||||
|
break; case EditCollapse: {
|
||||||
|
size_t ws;
|
||||||
|
for (pos = 0; pos < len;) {
|
||||||
|
for (; pos < len && !iswspace(buf[pos]); ++pos);
|
||||||
|
for (ws = pos; ws < len && iswspace(buf[ws]); ++ws);
|
||||||
|
if (pos && ws < len) {
|
||||||
|
delete(false, pos, ws - pos - 1);
|
||||||
|
buf[pos++] = L' ';
|
||||||
|
} else {
|
||||||
|
delete(false, pos, ws - pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break; case EditInsert: {
|
break; case EditInsert: {
|
||||||
if (reserve(pos, 1)) {
|
if (reserve(pos, 1)) {
|
||||||
|
|
2
ui.c
2
ui.c
|
@ -211,6 +211,7 @@ static short colorPair(short fg, short bg) {
|
||||||
X(KeyMetaF, "\33f", NULL) \
|
X(KeyMetaF, "\33f", NULL) \
|
||||||
X(KeyMetaL, "\33l", NULL) \
|
X(KeyMetaL, "\33l", NULL) \
|
||||||
X(KeyMetaM, "\33m", NULL) \
|
X(KeyMetaM, "\33m", NULL) \
|
||||||
|
X(KeyMetaQ, "\33q", NULL) \
|
||||||
X(KeyMetaU, "\33u", NULL) \
|
X(KeyMetaU, "\33u", NULL) \
|
||||||
X(KeyMetaV, "\33v", NULL) \
|
X(KeyMetaV, "\33v", NULL) \
|
||||||
X(KeyMetaEnter, "\33\r", "\33\n") \
|
X(KeyMetaEnter, "\33\r", "\33\n") \
|
||||||
|
@ -911,6 +912,7 @@ static void keyCode(int code) {
|
||||||
break; case KeyMetaF: edit(id, EditNextWord, 0);
|
break; case KeyMetaF: edit(id, EditNextWord, 0);
|
||||||
break; case KeyMetaL: bufferList(&window->buffer);
|
break; case KeyMetaL: bufferList(&window->buffer);
|
||||||
break; case KeyMetaM: waddch(window->pad, '\n');
|
break; case KeyMetaM: waddch(window->pad, '\n');
|
||||||
|
break; case KeyMetaQ: edit(id, EditCollapse, 0);
|
||||||
break; case KeyMetaU: windowScrollUnread(window);
|
break; case KeyMetaU: windowScrollUnread(window);
|
||||||
break; case KeyMetaV: windowScroll(window, +(PAGE_LINES - 2));
|
break; case KeyMetaV: windowScroll(window, +(PAGE_LINES - 2));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue