[readline] handle other arrow keys for movement in ncdirect_readline() #2214

pull/2242/head
nick black 3 years ago
parent e012046302
commit a643f6397d
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1011,9 +1011,13 @@ char* ncdirect_readline(ncdirect* n, const char* prompt){
} }
--wpos; --wpos;
}else if(id == NCKEY_LEFT){ }else if(id == NCKEY_LEFT){
if(wpos){ --wpos;
--wpos; }else if(id == NCKEY_RIGHT){
} ++wpos;
}else if(id == NCKEY_UP){
wpos -= dimx;
}else if(id == NCKEY_DOWN){
wpos += dimx;
}else{ }else{
if(wspace - 1 < wused){ if(wspace - 1 < wused){
wspace += BUFSIZ; wspace += BUFSIZ;
@ -1050,6 +1054,11 @@ char* ncdirect_readline(ncdirect* n, const char* prompt){
bline = y; bline = y;
} }
} }
if(wpos < 0){
wpos = 0;
}else if(wpos > wused - 1){
wpos = wused - 1;
}
// clear to end of line(s) // clear to end of line(s)
const char* el = get_escape(&n->tcache, ESCAPE_EL); const char* el = get_escape(&n->tcache, ESCAPE_EL);
for(int i = bline ; i >= tline ; --i){ for(int i = bline ; i >= tline ; --i){

Loading…
Cancel
Save