From 20cb29c2f8c5c87bc590896854a20b1473ceb358 Mon Sep 17 00:00:00 2001 From: "info@mode42.com" Date: Sat, 8 Aug 2026 03:54:55 +0000 Subject: #2 --- src/clients/client_line.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/clients/client_line.h (limited to 'src/clients/client_line.h') diff --git a/src/clients/client_line.h b/src/clients/client_line.h new file mode 100644 index 0000000..928efe0 --- /dev/null +++ b/src/clients/client_line.h @@ -0,0 +1,33 @@ +#ifndef HYBBX_CLIENT_LINE_H +#define HYBBX_CLIENT_LINE_H + +#include "hybbx/limits.h" +#include "hybbx/types.h" + +#include +#include + +typedef struct hybbx_client_line_editor { + char line[HYBBX_LINE_MAX]; + size_t line_len; + size_t line_cursor; + char history[HYBBX_HISTORY_MAX][HYBBX_LINE_MAX]; + unsigned history_count; + unsigned history_next; + int history_view; + char history_saved_line[HYBBX_LINE_MAX]; + int raw_enabled; + int stdin_fd; + unsigned char esc_state; + char csi_buf[24]; + size_t csi_len; + struct termios termios_saved; +} hybbx_client_line_editor_t; + +int hybbx_client_line_editor_start(hybbx_client_line_editor_t *ed, int stdin_fd); +void hybbx_client_line_editor_stop(hybbx_client_line_editor_t *ed); +hybbx_result_t hybbx_client_line_editor_poll(hybbx_client_line_editor_t *ed, + char *out_line, size_t out_len, + int *have_line, int *eof_seen); + +#endif /* HYBBX_CLIENT_LINE_H */ -- cgit v1.3.1