summaryrefslogtreecommitdiff
path: root/src/tty_interface.h
blob: 64af0b4783ff8fd117cec3cd5f5bc8f72c61eff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef TTY_INTERFACE_H
#define TTY_INTERFACE_H TTY_INTERFACE_H

#include "choices.h"
#include "options.h"
#include "tty.h"

#define SEARCH_SIZE_MAX 4096

typedef struct {
	tty_t *tty;
	choices_t *choices;
	options_t *options;

	char search[SEARCH_SIZE_MAX + 1];
	char last_search[SEARCH_SIZE_MAX + 1];
	size_t cursor;

	int ambiguous_key_pending;
	char input[32]; /* Pending input buffer */

	int exit;
} tty_interface_t;

void tty_interface_init(tty_interface_t *state, tty_t *tty, choices_t *choices, options_t *options);
int tty_interface_run(tty_interface_t *state);

#endif