private.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include <termios.h>
  2. #include "tinyrl/tinyrl.h"
  3. #include "tinyrl/vt100.h"
  4. /* define the class member data and virtual methods */
  5. struct _tinyrl {
  6. const char *line;
  7. unsigned max_line_length;
  8. char *prompt;
  9. size_t prompt_size; /* strlen() */
  10. size_t prompt_len; /* Symbol positions */
  11. char *buffer;
  12. size_t buffer_size;
  13. bool_t done;
  14. bool_t completion_over;
  15. bool_t completion_error_over;
  16. unsigned point;
  17. unsigned end;
  18. tinyrl_completion_func_t *attempted_completion_function;
  19. tinyrl_timeout_fn_t *timeout_fn; /* timeout callback */
  20. tinyrl_keypress_fn_t *keypress_fn; /* keypress callback */
  21. bool_t ins_flag; // Ins key changes mode of pressed keys
  22. int state;
  23. #define RL_STATE_COMPLETING (0x00000001)
  24. char *kill_string;
  25. #define NUM_HANDLERS 256
  26. tinyrl_key_func_t *handlers[NUM_HANDLERS];
  27. tinyrl_key_func_t *hotkey_fn;
  28. tinyrl_history_t *history;
  29. tinyrl_history_iterator_t hist_iter;
  30. tinyrl_vt100_t *term;
  31. void *context; /* context supplied by caller
  32. * to tinyrl_readline()
  33. */
  34. char echo_char;
  35. bool_t echo_enabled;
  36. struct termios default_termios;
  37. bool_t isatty;
  38. char *last_buffer; /* hold record of the previous
  39. buffer for redisplay purposes */
  40. unsigned int last_point; /* hold record of the previous
  41. cursor position for redisplay purposes */
  42. unsigned int last_line_size; /* The length of last_buffer */
  43. unsigned int last_width; /* Last terminal width. For resize */
  44. bool_t utf8; /* Is the encoding UTF-8 */
  45. bool_t machine_interface; /* Mashine/Human interface flag */
  46. };