mirror of
https://github.com/troglobit/editline.git
synced 2025-09-15 15:58:11 +08:00
Fix #15: Alternate interface to plain readline(), for event loops
This rather big patch adds support for the GNU Readline alternate interface, for use with event loops: void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler); void rl_callback_read_char (void); void rl_callback_handler_remove (void); The code has been tested using the testit and excallback examples. Both regular editing and searching works as intended. Also, the problem with lingering artefacts on screen when scrolling through the history has been fixed. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -51,6 +51,7 @@ typedef int rl_hook_func_t(void);
|
||||
typedef int rl_getc_func_t(void);
|
||||
typedef void rl_voidfunc_t(void);
|
||||
typedef void rl_vintfunc_t(int);
|
||||
typedef void rl_vcpfunc_t(char *);
|
||||
|
||||
/* Display 8-bit chars "as-is" or as `M-x'? Toggle with M-m. (Default:0 - "as-is") */
|
||||
extern int rl_meta_chars;
|
||||
@@ -107,6 +108,11 @@ extern int write_history (const char *filename);
|
||||
extern rl_complete_func_t *rl_set_complete_func (rl_complete_func_t *func);
|
||||
extern rl_list_possib_func_t *rl_set_list_possib_func (rl_list_possib_func_t *func);
|
||||
|
||||
/* Alternate interface to plain readline(), for event loops */
|
||||
extern void rl_callback_handler_install (const char *prompt, rl_vcpfunc_t *lhandler);
|
||||
extern void rl_callback_read_char (void);
|
||||
extern void rl_callback_handler_remove (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user