#ifndef YTMDL_INPUT_FIELD_H
#define YTMDL_INPUT_FIELD_H
#include <ncurses.h>
#include <stddef.h>
#define INPUT_FIELD_CAP 2048
typedef struct {
char buf[INPUT_FIELD_CAP];
size_t len;
size_t cursor;
} InputField;
void input_field_init(InputField *f);
void input_field_clear(InputField *f);
/* Feeds a curses key code to the field. Returns 1 if it was an editing key
* (consumed), 0 if the caller should handle it itself (e.g. Enter, Tab). */
int input_field_handle_key(InputField *f, int ch);
void input_field_draw(WINDOW *win, int y, int x, int width, const InputField *f, int focused,
const char *placeholder);
#endif