mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
decode more special keys in notcurses-input #134
This commit is contained in:
parent
91f74901c2
commit
3b2f72538e
@ -396,6 +396,20 @@ ncplane_putsimple_yx(struct ncplane* n, int y, int x, char c){
|
|||||||
return ncplane_putsimple(n, 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
|
// Replace the cell underneath the cursor with the provided EGC, using the
|
||||||
// specified 'attr' and 'channels' for styling, and advance the cursor by 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
|
// 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_F10: return "F10";
|
||||||
case NCKEY_F11: return "F11";
|
case NCKEY_F11: return "F11";
|
||||||
case NCKEY_F12: return "F12";
|
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";
|
default: return "unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,8 +129,8 @@ handle_getc(notcurses* nc, int kpress){
|
|||||||
}
|
}
|
||||||
// FIXME ungetc on failure! walk trie backwards or something
|
// FIXME ungetc on failure! walk trie backwards or something
|
||||||
}
|
}
|
||||||
if(kpress == 0x04){ // ctrl-d, treated as EOF
|
if(kpress == 0x7f){ // ASCII del, treated as backspace
|
||||||
return (wchar_t)-1;
|
return NCKEY_BACKSPACE;
|
||||||
}
|
}
|
||||||
if(kpress < 0x80){
|
if(kpress < 0x80){
|
||||||
return kpress;
|
return kpress;
|
||||||
|
Loading…
Reference in New Issue
Block a user