mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 13:02:09 +02:00
LibGUI: Don't re-trigger the autocomplete box when the timer fires
Previously there was a situation where the autocomplete box would appear to "jump" to the side. This was due to the following race condition: 1. Start typing, thus triggering the autocomplete timer to start 2. Manually trigger autocomplete before the timer finishes 3. Continue typing 4. The autocomplete timer now fires When the timer fires it causes the autocomplete box to show, which, if it is already shown, has the effect of moving the box to the current cursor position.
This commit is contained in:
committed by
Andreas Kling
parent
8462234208
commit
7a2c8452f1
Notes:
sideshowbarker
2024-07-18 01:34:02 +09:00
Author: https://github.com/thislooksfun Commit: https://github.com/SerenityOS/serenity/commit/7a2c8452f16 Pull-request: https://github.com/SerenityOS/serenity/pull/10642
@@ -1987,7 +1987,10 @@ void TextEditor::set_should_autocomplete_automatically(bool value)
|
||||
|
||||
if (value) {
|
||||
VERIFY(m_autocomplete_provider);
|
||||
m_autocomplete_timer = Core::Timer::create_single_shot(m_automatic_autocomplete_delay_ms, [this] { try_show_autocomplete(UserRequestedAutocomplete::No); });
|
||||
m_autocomplete_timer = Core::Timer::create_single_shot(m_automatic_autocomplete_delay_ms, [this] {
|
||||
if (m_autocomplete_box && !m_autocomplete_box->is_visible())
|
||||
try_show_autocomplete(UserRequestedAutocomplete::No);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user