Add C-v and M-v

I figure there should be some way to scroll without keypad, and
apparently this is what emacs offers...
master
C. McEnroe 2020-02-12 01:00:39 -05:00
parent d73085eaa9
commit aab9f76fa0
2 changed files with 9 additions and 1 deletions

View File

@ -291,6 +291,8 @@ Switch to next window.
Switch to previously selected window. Switch to previously selected window.
.It Ic C-p .It Ic C-p
Switch to previous window. Switch to previous window.
.It Ic C-v
Scroll down a page.
.It Ic M-/ .It Ic M-/
Switch to previously selected window. Switch to previously selected window.
.It Ic M-a .It Ic M-a
@ -308,6 +310,8 @@ Insert a blank line in the window.
Switch to window by number 0\(en9. Switch to window by number 0\(en9.
.It Ic M-u .It Ic M-u
Scroll to first unread line. Scroll to first unread line.
.It Ic M-v
Scroll up a page.
.El .El
. .
.Ss IRC Formatting .Ss IRC Formatting

6
ui.c
View File

@ -171,7 +171,7 @@ static const char *ExitFocusMode = "\33[?1004l";
static const char *EnterPasteMode = "\33[?2004h"; static const char *EnterPasteMode = "\33[?2004h";
static const char *ExitPasteMode = "\33[?2004l"; static const char *ExitPasteMode = "\33[?2004l";
// Gain use of C-q, C-s, C-c, C-z, C-y, C-o. // Gain use of C-q, C-s, C-c, C-z, C-y, C-v, C-o.
static void acquireKeys(void) { static void acquireKeys(void) {
struct termios term; struct termios term;
int error = tcgetattr(STDOUT_FILENO, &term); int error = tcgetattr(STDOUT_FILENO, &term);
@ -182,6 +182,7 @@ static void acquireKeys(void) {
#ifdef VDSUSP #ifdef VDSUSP
term.c_cc[VDSUSP] = _POSIX_VDISABLE; term.c_cc[VDSUSP] = _POSIX_VDISABLE;
#endif #endif
term.c_cc[VLNEXT] = _POSIX_VDISABLE;
term.c_cc[VDISCARD] = _POSIX_VDISABLE; term.c_cc[VDISCARD] = _POSIX_VDISABLE;
error = tcsetattr(STDOUT_FILENO, TCSADRAIN, &term); error = tcsetattr(STDOUT_FILENO, TCSADRAIN, &term);
if (error) err(EX_OSERR, "tcsetattr"); if (error) err(EX_OSERR, "tcsetattr");
@ -211,6 +212,7 @@ static void errExit(void) {
X(KeyMetaL, "\33l") \ X(KeyMetaL, "\33l") \
X(KeyMetaM, "\33m") \ X(KeyMetaM, "\33m") \
X(KeyMetaU, "\33u") \ X(KeyMetaU, "\33u") \
X(KeyMetaV, "\33v") \
X(KeyMetaSlash, "\33/") \ X(KeyMetaSlash, "\33/") \
X(KeyFocusIn, "\33[I") \ X(KeyFocusIn, "\33[I") \
X(KeyFocusOut, "\33[O") \ X(KeyFocusOut, "\33[O") \
@ -802,6 +804,7 @@ static void keyCode(int code) {
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 KeyMetaU: windowScrollUnread(window); break; case KeyMetaU: windowScrollUnread(window);
break; case KeyMetaV: windowScroll(window, +(PAGE_LINES - 2));
break; case KEY_BACKSPACE: edit(id, EditDeletePrev, 0); break; case KEY_BACKSPACE: edit(id, EditDeletePrev, 0);
break; case KEY_DC: edit(id, EditDeleteNext, 0); break; case KEY_DC: edit(id, EditDeleteNext, 0);
@ -843,6 +846,7 @@ static void keyCtrl(wchar_t ch) {
break; case L'P': windowShow(windows.active->prev); break; case L'P': windowShow(windows.active->prev);
break; case L'U': edit(id, EditDeleteHead, 0); break; case L'U': edit(id, EditDeleteHead, 0);
break; case L'W': edit(id, EditDeletePrevWord, 0); break; case L'W': edit(id, EditDeletePrevWord, 0);
break; case L'V': windowScroll(windows.active, -(PAGE_LINES - 2));
break; case L'Y': edit(id, EditPaste, 0); break; case L'Y': edit(id, EditPaste, 0);
} }
} }