readline PoC

pull/2212/head
nick black 3 years ago
parent 671656ea80
commit 3ddbb3c2ec
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -955,6 +955,7 @@ char* ncdirect_readline(ncdirect* n, const char* prompt){
}
return readline(prompt);
#else
logerror("notcurses was built without readline support\n");
(void)n;
(void)prompt;
return NULL;

@ -0,0 +1,26 @@
#include <notcurses/direct.h>
// play with libreadline as wrapped by notcurses-direct
static int
rl(struct ncdirect* n){
char* l;
while( (l = ncdirect_readline(n, "ncdirect")) ){
fprintf(stderr, "input: [%s]\n", l);
free(l);
}
return 0;
}
int main(void){
uint64_t flags = NCDIRECT_OPTION_INHIBIT_CBREAK;
struct ncdirect* n = ncdirect_core_init(NULL, NULL, flags);
if(n == NULL){
return EXIT_FAILURE;
}
rl(n);
if(ncdirect_stop(n)){
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
Loading…
Cancel
Save