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 | |
parent | 492d80a084685fc30bb8e9ef7689dcdcbe9ab307 (diff) |
Editing bookmark icons
IssueID #140
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 3 | ||||
-rw-r--r-- | src/ui/inputwidget.c | 10 | ||||
-rw-r--r-- | src/ui/sidebarwidget.c | 6 |
3 files changed, 15 insertions, 4 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 69461901..2e81838f 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -670,9 +670,10 @@ static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) { | |||
670 | const iChar siteIcon = siteIcon_GmDocument(d->doc); | 670 | const iChar siteIcon = siteIcon_GmDocument(d->doc); |
671 | if (siteIcon) { | 671 | if (siteIcon) { |
672 | if (!isEmpty_String(text)) { | 672 | if (!isEmpty_String(text)) { |
673 | prependCStr_String(text, " "); | 673 | prependCStr_String(text, " " restore_ColorEscape); |
674 | } | 674 | } |
675 | prependChar_String(text, siteIcon); | 675 | prependChar_String(text, siteIcon); |
676 | prependCStr_String(text, escape_Color(uiIcon_ColorId)); | ||
676 | } | 677 | } |
677 | const int width = advanceRange_Text(default_FontId, range_String(text)).x; | 678 | const int width = advanceRange_Text(default_FontId, range_String(text)).x; |
678 | if (width <= avail || | 679 | if (width <= avail || |
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; |
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 36aa1235..54812aec 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -689,8 +689,10 @@ iBool handleBookmarkEditorCommands_SidebarWidget_(iWidget *editor, const char *c | |||
689 | removeTag_Bookmark(bm, "usericon"); | 689 | removeTag_Bookmark(bm, "usericon"); |
690 | bm->icon = 0; | 690 | bm->icon = 0; |
691 | } | 691 | } |
692 | else if (!hasTag_Bookmark(bm, "usericon")) { | 692 | else { |
693 | addTag_Bookmark(bm, "usericon"); | 693 | if (!hasTag_Bookmark(bm, "usericon")) { |
694 | addTag_Bookmark(bm, "usericon"); | ||
695 | } | ||
694 | bm->icon = first_String(icon); | 696 | bm->icon = first_String(icon); |
695 | } | 697 | } |
696 | postCommand_App("bookmarks.changed"); | 698 | postCommand_App("bookmarks.changed"); |