diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-11 08:15:03 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-10-11 08:15:03 +0300 |
commit | 463174066a2490522afc9b4dc95efeffbc498354 (patch) | |
tree | f90aa69ba3473a9adf76f91f895d95c9144f49d6 /src/ui/inputwidget.c | |
parent | a4bb1b093e1a452831b55dc40efb38c5479b13b5 (diff) |
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.
Diffstat (limited to 'src/ui/inputwidget.c')
-rw-r--r-- | src/ui/inputwidget.c | 10 |
1 files changed, 8 insertions, 2 deletions
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) { | |||
181 | iConstForEach(String, i, text) { | 181 | iConstForEach(String, i, text) { |
182 | pushBack_Array(&d->text, &i.value); | 182 | pushBack_Array(&d->text, &i.value); |
183 | } | 183 | } |
184 | iZap(d->mark); | 184 | if (isFocused_Widget(d)) { |
185 | d->cursor = iMin(d->cursor, size_Array(&d->text)); | 185 | d->cursor = size_Array(&d->text); |
186 | selectAll_InputWidget(d); | ||
187 | } | ||
188 | else { | ||
189 | d->cursor = iMin(d->cursor, size_Array(&d->text)); | ||
190 | iZap(d->mark); | ||
191 | } | ||
186 | refresh_Widget(as_Widget(d)); | 192 | refresh_Widget(as_Widget(d)); |
187 | } | 193 | } |
188 | 194 | ||