From 463174066a2490522afc9b4dc95efeffbc498354 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Sun, 11 Oct 2020 08:15:03 +0300 Subject: Focus behavior of the URL entry field Opening a new tab will now set input focus to the URL field. Switching tabs when the URL field is focused will select the full new URL. There was an issue previously where selecting a bookmark while the URL field was focused would cause unexpected behavior. The URL was first unfocused and that would trigger the document to fetch the URL that was in the input field. --- src/ui/inputwidget.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/ui/inputwidget.c') diff --git a/src/ui/inputwidget.c b/src/ui/inputwidget.c index d29548f1..0fcca40a 100644 --- a/src/ui/inputwidget.c +++ b/src/ui/inputwidget.c @@ -181,8 +181,14 @@ void setText_InputWidget(iInputWidget *d, const iString *text) { iConstForEach(String, i, text) { pushBack_Array(&d->text, &i.value); } - iZap(d->mark); - d->cursor = iMin(d->cursor, size_Array(&d->text)); + if (isFocused_Widget(d)) { + d->cursor = size_Array(&d->text); + selectAll_InputWidget(d); + } + else { + d->cursor = iMin(d->cursor, size_Array(&d->text)); + iZap(d->mark); + } refresh_Widget(as_Widget(d)); } -- cgit v1.2.3