Skip to content

Commit 8e66b98

Browse files
authored
Merge pull request #7 from sysprog21/fix-textarea
Fix text input focus loss in searchbar/textfield
2 parents fe57cc5 + 41c4b76 commit 8e66b98

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/input.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,9 @@ iui_textfield_result iui_textfield_with_selection(
857857
if (!ctx->current_window || !buffer || !state || size == 0)
858858
return result;
859859

860+
/* Register this text field for per-frame tracking */
861+
iui_register_textfield(ctx, buffer);
862+
860863
/* Default options if NULL */
861864
iui_textfield_options opts = {0};
862865
if (options)

src/searchbar.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ iui_search_bar_result iui_search_bar_ex(iui_context *ctx,
2929
if (!ctx || !ctx->current_window || !buffer || !cursor || size == 0)
3030
return result;
3131

32+
/* Register this text field for per-frame tracking */
33+
iui_register_textfield(ctx, buffer);
34+
3235
/* Default icons */
3336
const char *lead_icon = leading_icon ? leading_icon : "search";
3437
bool has_text = (buffer[0] != '\0');
@@ -344,8 +347,9 @@ bool iui_search_view_begin(iui_context *ctx,
344347
ctx->colors.surface_container_high,
345348
ctx->renderer.user);
346349

347-
/* Auto-focus the search field */
350+
/* Auto-focus the search field and register for tracking */
348351
ctx->focused_edit = search->query;
352+
iui_register_textfield(ctx, search->query);
349353

350354
/* Handle text input */
351355
iui_process_text_input(ctx, search->query, sizeof(search->query),

0 commit comments

Comments
 (0)