mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 18:57:34 +00:00
LibGUI: Some tweaks for TextEditor's will-execute-command virtual
Renamed the virtual from "on_edit_action" to "will_execute" so it doesn't clash with our convention for Function hook names. Also tighten the parameter type to GUI::TextDocumentUndoCommand since that's the only kind of command it will receive.
This commit is contained in:
parent
aaa96e909b
commit
244665d99c
3 changed files with 4 additions and 5 deletions
|
@ -488,7 +488,7 @@ void Editor::LanguageServerAidedAutocompleteProvider::provide_completions(Functi
|
||||||
data.value().position.column());
|
data.value().position.column());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::on_edit_action(const GUI::Command& command)
|
void Editor::will_execute(GUI::TextDocumentUndoCommand const& command)
|
||||||
{
|
{
|
||||||
if (!m_language_client)
|
if (!m_language_client)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -41,8 +41,7 @@ public:
|
||||||
CodeDocument& code_document();
|
CodeDocument& code_document();
|
||||||
|
|
||||||
virtual void set_document(GUI::TextDocument&) override;
|
virtual void set_document(GUI::TextDocument&) override;
|
||||||
|
virtual void will_execute(GUI::TextDocumentUndoCommand const&) override;
|
||||||
virtual void on_edit_action(const GUI::Command&) override;
|
|
||||||
|
|
||||||
virtual void undo() override;
|
virtual void undo() override;
|
||||||
virtual void redo() override;
|
virtual void redo() override;
|
||||||
|
|
|
@ -285,12 +285,12 @@ private:
|
||||||
{
|
{
|
||||||
auto command = make<T>(*m_document, forward<Args>(args)...);
|
auto command = make<T>(*m_document, forward<Args>(args)...);
|
||||||
command->perform_formatting(*this);
|
command->perform_formatting(*this);
|
||||||
on_edit_action(*command);
|
will_execute(*command);
|
||||||
command->execute_from(*this);
|
command->execute_from(*this);
|
||||||
m_document->add_to_undo_stack(move(command));
|
m_document->add_to_undo_stack(move(command));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void on_edit_action(const Command&) { }
|
virtual void will_execute(TextDocumentUndoCommand const&) { }
|
||||||
|
|
||||||
Type m_type { MultiLine };
|
Type m_type { MultiLine };
|
||||||
Mode m_mode { Editable };
|
Mode m_mode { Editable };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue