37 #define EDITBOX_MIN_CHARS 3 46 const char *content = *(
box->string.buf);
48 char buf[ width + 1 ];
49 signed int cursor_offset, underflow, overflow,
first;
53 cursor_offset = (
box->string.cursor -
box->first );
55 overflow = ( cursor_offset - ( width - 1 ) );
57 if ( underflow > 0 ) {
61 }
else if ( overflow > 0 ) {
65 cursor_offset = (
box->string.cursor -
first );
68 memset ( buf,
'_', width );
Editable text box widget.
int box(WINDOW *win, chtype verch, chtype horch)
Draw borders from single-byte characters and renditions around a window.
uint32_t first
First block in range.
#define CPAIR_EDIT
Editable text.
int edit_string(struct edit_string *string, int key)
Edit editable string.
#define mvprintw(y, x, fmt,...)
static void draw_editbox(struct widget *widget)
Draw text box widget.
#define CPAIR_NORMAL
Normal text.
struct widget_operations editbox_operations
Text box widget operations.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define container_of(ptr, type, field)
Get containing structure.
static int edit_editbox(struct widget *widget, int key)
Edit text box widget.
An editable text box widget.
size_t strlen(const char *src)
Get length of string.
static int move(int y, int x)
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define color_set(cpno, opts)
#define EDITBOX_MIN_CHARS
#define NULL
NULL pointer (VOID *)
void * memset(void *dest, int character, size_t len) __nonnull