decode more special keys in notcurses-input #134

pull/144/head
nick black 5 years ago
parent 91f74901c2
commit 3b2f72538e
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -396,6 +396,20 @@ ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c){
return ncplane_putsimple(n, c);
}
// Replace the cell underneath the cursor with the provided wide char 'w'.
// Advance the cursor by the character's width as reported by wcwidth(). On
// success, returns 1. On failure, returns -1.
API int ncplane_putwc(struct ncplane* n, wchar_t w);
// Call ncplane_putwc() after successfully moving to y, x.
static inline int
ncplane_putwc_yx(struct ncplane* n, int y, int x, wchar_t w){
if(ncplane_cursor_move_yx(n, y, x)){
return -1;
}
return ncplane_putwc(n, w);
}
// Replace the cell underneath the cursor with the provided EGC, using the
// specified 'attr' and 'channels' for styling, and advance the cursor by the
// width of the cluster (but not past the end of the plane). On success, returns

@ -39,6 +39,22 @@ const char* nckeystr(wchar_t spkey){
case NCKEY_F10: return "F10";
case NCKEY_F11: return "F11";
case NCKEY_F12: return "F12";
case NCKEY_BACKSPACE: return "backspace";
case NCKEY_CENTER: return "center";
case NCKEY_ENTER: return "enter";
case NCKEY_CLS: return "clear";
case NCKEY_DLEFT: return "down+left";
case NCKEY_DRIGHT: return "down+right";
case NCKEY_ULEFT: return "up+left";
case NCKEY_URIGHT: return "up+right";
case NCKEY_BEGIN: return "begin";
case NCKEY_CANCEL: return "cancel";
case NCKEY_CLOSE: return "close";
case NCKEY_COMMAND: return "command";
case NCKEY_COPY: return "copy";
case NCKEY_EXIT: return "exit";
case NCKEY_PRINT: return "print";
case NCKEY_REFRESH: return "refresh";
default: return "unknown";
}
}

@ -129,8 +129,8 @@ handle_getc(notcurses* nc, int kpress){
}
// FIXME ungetc on failure! walk trie backwards or something
}
if(kpress == 0x04){ // ctrl-d, treated as EOF
return (wchar_t)-1;
if(kpress == 0x7f){ // ASCII del, treated as backspace
return NCKEY_BACKSPACE;
}
if(kpress < 0x80){
return kpress;

Loading…
Cancel
Save