summaryrefslogtreecommitdiff
path: root/src/ui/lookupwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-09-25 10:59:28 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-09-25 10:59:28 +0300
commitc80331992585bfee3d65a7ba24f3a4b640c48735 (patch)
tree5eaa85a0a3a1c46bdca7cccfae0e7349e22f6d13 /src/ui/lookupwidget.c
parent562a0d2d38c0621a296e8343270f3f1efc268156 (diff)
parent242e8231ea61278fe482020658be86c2dec0ae53 (diff)
Merge branch 'work/v1.7' into dev
Diffstat (limited to 'src/ui/lookupwidget.c')
-rw-r--r--src/ui/lookupwidget.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/ui/lookupwidget.c b/src/ui/lookupwidget.c
index a0a507ca..ab649eee 100644
--- a/src/ui/lookupwidget.c
+++ b/src/ui/lookupwidget.c
@@ -171,6 +171,9 @@ static float scoreMatch_(const iRegExp *pattern, iRangecc text) {
171} 171}
172 172
173static float bookmarkRelevance_LookupJob_(const iLookupJob *d, const iBookmark *bm) { 173static float bookmarkRelevance_LookupJob_(const iLookupJob *d, const iBookmark *bm) {
174 if (isFolder_Bookmark(bm)) {
175 return 0.0f;
176 }
174 iUrl parts; 177 iUrl parts;
175 init_Url(&parts, &bm->url); 178 init_Url(&parts, &bm->url);
176 const float t = scoreMatch_(d->term, range_String(&bm->title)); 179 const float t = scoreMatch_(d->term, range_String(&bm->title));
@@ -388,7 +391,7 @@ void init_LookupWidget(iLookupWidget *d) {
388 init_Widget(w); 391 init_Widget(w);
389 setId_Widget(w, "lookup"); 392 setId_Widget(w, "lookup");
390 setFlags_Widget(w, focusable_WidgetFlag, iTrue); 393 setFlags_Widget(w, focusable_WidgetFlag, iTrue);
391#if defined (iPlatformAppleMobile) 394#if defined (iPlatformMobile)
392 setFlags_Widget(w, unhittable_WidgetFlag, iTrue); 395 setFlags_Widget(w, unhittable_WidgetFlag, iTrue);
393#endif 396#endif
394 d->list = addChildFlags_Widget(w, iClob(new_ListWidget()), 397 d->list = addChildFlags_Widget(w, iClob(new_ListWidget()),
@@ -747,12 +750,19 @@ static iBool processEvent_LookupWidget_(iLookupWidget *d, const SDL_Event *ev) {
747 return iTrue; 750 return iTrue;
748 } 751 }
749 } 752 }
750 if (isVisible_Widget(w) && 753 /* Focus switching between URL bar and lookup results. */
751 key == SDLK_DOWN && !mods && focus_Widget() == findWidget_App("url") && 754 if (isVisible_Widget(w)) {
752 numItems_ListWidget(d->list)) { 755 if (((key == SDLK_DOWN && !mods) || key == SDLK_TAB) &&
753 setCursor_LookupWidget_(d, 1); /* item 0 is always the first heading */ 756 focus_Widget() == findWidget_App("url") &&
754 setFocus_Widget(w); 757 numItems_ListWidget(d->list)) {
755 return iTrue; 758 setCursor_LookupWidget_(d, 1); /* item 0 is always the first heading */
759 setFocus_Widget(w);
760 return iTrue;
761 }
762 else if (key == SDLK_TAB && isFocused_Widget(w)) {
763 setFocus_Widget(findWidget_App("url"));
764 return iTrue;
765 }
756 } 766 }
757 } 767 }
758 return processEvent_Widget(w, ev); 768 return processEvent_Widget(w, ev);