commit 8ce1eb2bb5bac39ed33dd3aace28d40a53878c16
parent 3fc9c4d7ee1bd9a05b7bed3e835861923b6c9b28
Author: Tom Schwindl <schwindl@posteo.de>
Date: Wed, 11 Jan 2023 16:08:36 +0100
slackline: restore some comments
Diffstat:
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/slackline.c b/slackline.c
@@ -164,7 +164,7 @@ sl_default(struct slackline *sl, int key)
case CTRL_U:
sl_reset(sl);
break;
- case CTRL_W:
+ case CTRL_W: /* erase previous word */
while (sl->rcur != 0 && isspace((unsigned char) *(sl->ptr-1)))
sl_backspace(sl);
while (sl->rcur != 0 && !isspace((unsigned char) *(sl->ptr-1)))
diff --git a/slackline_emacs.c b/slackline_emacs.c
@@ -15,13 +15,13 @@ sl_emacs(struct slackline *sl, int key)
case ESC_KEY:
sl->esc = ESC;
break;
- case CTRL_A:
+ case CTRL_A: /* start of line */
sl_move(sl, HOME);
break;
- case CTRL_B:
+ case CTRL_B: /* previous char */
sl_move(sl, LEFT);
break;
- case CTRL_D:
+ case CTRL_D: /* delete char in front of the cursor or exit */
if (sl->rcur < sl->rlen) {
sl_move(sl, RIGHT);
sl_backspace(sl);
@@ -29,19 +29,19 @@ sl_emacs(struct slackline *sl, int key)
exit(EXIT_SUCCESS);
}
break;
- case CTRL_E:
+ case CTRL_E: /* end of line */
sl_move(sl, END);
break;
- case CTRL_F:
+ case CTRL_F: /* next char */
sl_move(sl, RIGHT);
break;
- case CTRL_K:
+ case CTRL_K: /* delete line from cursor to end */
for (int i = sl->rlen - sl->rcur; i > 0; --i) {
sl_move(sl, RIGHT);
sl_backspace(sl);
}
break;
- case CTRL_T:
+ case CTRL_T: /* swap last two chars */
if (sl->rcur >= 2) {
tmp = *sl_postoptr(sl, sl->rcur-1);
sl->buf[sl->rcur-1] = *sl_postoptr(sl, sl->rcur-2);