mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
readline PoC
This commit is contained in:
parent
671656ea80
commit
3ddbb3c2ec
@ -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;
|
||||
|
26
src/poc/readline.c
Normal file
26
src/poc/readline.c
Normal file
@ -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…
Reference in New Issue
Block a user