diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-23 06:10:40 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-02-23 06:10:40 +0200 |
commit | f79e6735864a16c20d0ed0cc9d79c8c20aeb4816 (patch) | |
tree | 24b2b2399919ad4507fec805da39b333bd795846 /src/ui/inputwidget.c | |
parent | 492d80a084685fc30bb8e9ef7689dcdcbe9ab307 (diff) |
Editing bookmark icons
IssueID #140
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index e51ec64b..25c3e145 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c | |||
@@ -346,10 +346,13 @@ static void insertChar_InputWidget_(iInputWidget *d, iChar chr) { | |||
346 | resize_Array(&d->text, d->cursor + 1); | 346 | resize_Array(&d->text, d->cursor + 1); |
347 | } | 347 | } |
348 | set_Array(&d->text, d->cursor++, &chr); | 348 | set_Array(&d->text, d->cursor++, &chr); |
349 | if (d->maxLen && d->cursor == d->maxLen) { | 349 | if (d->maxLen > 1 && d->cursor == d->maxLen) { |
350 | iWidget *nextFocus = findFocusable_Widget(w, forward_WidgetFocusDir); | 350 | iWidget *nextFocus = findFocusable_Widget(w, forward_WidgetFocusDir); |
351 | setFocus_Widget(nextFocus == w ? NULL : nextFocus); | 351 | setFocus_Widget(nextFocus == w ? NULL : nextFocus); |
352 | } | 352 | } |
353 | else if (d->maxLen == 1) { | ||
354 | d->cursor = 0; | ||
355 | } | ||
353 | } | 356 | } |
354 | showCursor_InputWidget_(d); | 357 | showCursor_InputWidget_(d); |
355 | refresh_Widget(as_Widget(d)); | 358 | refresh_Widget(as_Widget(d)); |
@@ -675,6 +678,11 @@ static iBool processEvent_InputWidget_(iInputWidget *d, const SDL_Event *ev) { | |||
675 | remove_Array(&d->text, --d->cursor); | 678 | remove_Array(&d->text, --d->cursor); |
676 | contentsWereChanged_InputWidget_(d); | 679 | contentsWereChanged_InputWidget_(d); |
677 | } | 680 | } |
681 | else if (d->cursor == 0 && d->maxLen == 1) { | ||
682 | pushUndo_InputWidget_(d); | ||
683 | clear_Array(&d->text); | ||
684 | contentsWereChanged_InputWidget_(d); | ||
685 | } | ||
678 | showCursor_InputWidget_(d); | 686 | showCursor_InputWidget_(d); |
679 | refresh_Widget(w); | 687 | refresh_Widget(w); |
680 | return iTrue; | 688 | return iTrue; |