mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
ncreader: Alt-B, Alt-F for cursor movement #983
This commit is contained in:
parent
1f59eef9d8
commit
8bbd134504
@ -226,17 +226,8 @@ int ncreader_write_egc(ncreader* n, const char* egc){
|
||||
return 0;
|
||||
}
|
||||
|
||||
// we pass along:
|
||||
// * anything with Alt
|
||||
// * anything with Ctrl, except 'U' (which clears all input)
|
||||
// * anything synthesized, save arrow keys and backspace
|
||||
bool ncreader_offer_input(ncreader* n, const ncinput* ni){
|
||||
int x = n->textarea->x;
|
||||
int y = n->textarea->y;
|
||||
if(ni->alt){ // pass on all alts
|
||||
return false;
|
||||
}
|
||||
if(ni->ctrl && !n->no_cmd_keys){
|
||||
static bool
|
||||
ncreader_ctrl_input(ncreader* n, const ncinput* ni){
|
||||
switch(ni->id){
|
||||
case 'U':
|
||||
ncplane_erase(n->ncp); // homes the cursor
|
||||
@ -253,6 +244,37 @@ bool ncreader_offer_input(ncreader* n, const ncinput* ni){
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
ncreader_alt_input(ncreader* n, const ncinput* ni){
|
||||
switch(ni->id){
|
||||
case 'B': // back one word (to first cell) FIXME
|
||||
ncreader_move_left(n);
|
||||
break;
|
||||
case 'F': // forward one word (past end cell) FIXME
|
||||
ncreader_move_right(n);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// we pass along:
|
||||
// * anything with Alt
|
||||
// * anything with Ctrl, except 'U' (which clears all input)
|
||||
// * anything synthesized, save arrow keys and backspace
|
||||
bool ncreader_offer_input(ncreader* n, const ncinput* ni){
|
||||
int x = n->textarea->x;
|
||||
int y = n->textarea->y;
|
||||
if(ni->alt){ // pass on all alts
|
||||
return false;
|
||||
}
|
||||
if(ni->ctrl && !n->no_cmd_keys){
|
||||
return ncreader_ctrl_input(n, ni);
|
||||
}else if(ni->alt && !n->no_cmd_keys){
|
||||
return ncreader_alt_input(n, ni);
|
||||
}
|
||||
if(ni->id == NCKEY_BACKSPACE){
|
||||
if(n->textarea->x == 0){
|
||||
if(n->textarea->y){
|
||||
|
Loading…
Reference in New Issue
Block a user