mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00: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:
parent
8462234208
commit
7a2c8452f1
1 changed files with 4 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue