mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 09:17:36 +00:00
LibGUI: Run TextEditor::on_change callback immediately
This is the only Widget that ran its callback in deferred_invoke(). It
seems to be a holdover from when syntax-highlighting ran whenever the
text changed, but that has not been true since
bec2b3086c
. Running the callback
immediately has no obvious downsides, but does make it a lot easier to
reason about. (I might have spent an hour confused as to why things
were happening in the wrong order...)
This commit is contained in:
parent
0836912a6d
commit
ebbbca98fa
2 changed files with 2 additions and 9 deletions
|
@ -1576,14 +1576,8 @@ void TextEditor::did_change(AllowCallback allow_callback)
|
||||||
recompute_all_visual_lines();
|
recompute_all_visual_lines();
|
||||||
hide_autocomplete_if_needed();
|
hide_autocomplete_if_needed();
|
||||||
m_needs_rehighlight = true;
|
m_needs_rehighlight = true;
|
||||||
if (!m_has_pending_change_notification) {
|
if (on_change && allow_callback == AllowCallback::Yes)
|
||||||
m_has_pending_change_notification = true;
|
on_change();
|
||||||
deferred_invoke([this, allow_callback] {
|
|
||||||
m_has_pending_change_notification = false;
|
|
||||||
if (on_change && allow_callback == AllowCallback::Yes)
|
|
||||||
on_change();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void TextEditor::set_mode(const Mode mode)
|
void TextEditor::set_mode(const Mode mode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -361,7 +361,6 @@ private:
|
||||||
bool m_ruler_visible { false };
|
bool m_ruler_visible { false };
|
||||||
bool m_gutter_visible { false };
|
bool m_gutter_visible { false };
|
||||||
bool m_needs_rehighlight { false };
|
bool m_needs_rehighlight { false };
|
||||||
bool m_has_pending_change_notification { false };
|
|
||||||
bool m_automatic_indentation_enabled { false };
|
bool m_automatic_indentation_enabled { false };
|
||||||
WrappingMode m_wrapping_mode { WrappingMode::NoWrap };
|
WrappingMode m_wrapping_mode { WrappingMode::NoWrap };
|
||||||
bool m_visualize_trailing_whitespace { true };
|
bool m_visualize_trailing_whitespace { true };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue