colourpicker

Simple Colour Picker written in C
git clone anongit@rnpnr.xyz:colourpicker.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

Commit: b79ab936e56e0ae1880b91331cc84894ab1a74fa
Parent: 33df2a5a73a1737418c56b35907380b6e1c5bb46
Author: Randy Palamar
Date:   Fri, 16 Aug 2024 13:50:18 -0600

support delete key for text input

Diffstat:
Mcolourpicker.c | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/colourpicker.c b/colourpicker.c @@ -423,6 +423,13 @@ do_text_input(ColourPickerCtx *ctx, Rect r, Color colour, i32 max_disp_chars) ctx->is.buf_len--; } + if ((IsKeyPressed(KEY_DELETE) || IsKeyPressedRepeat(KEY_DELETE)) && + ctx->is.cursor < ctx->is.buf_len) { + mem_move(ctx->is.buf + ctx->is.cursor + 1, + ctx->is.buf + ctx->is.cursor, + ctx->is.buf_len - ctx->is.cursor); + } + if (IsKeyPressed(KEY_ENTER)) { parse_and_store_text_input(ctx); ctx->is.idx = -1;