1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:17:35 +00:00

HackStudio+TextEditor: Persist EditingEngineType across editors

Persist EditingEngine mode in HackStudio and TextEditor when opening new
files or editing splits. Previously, the EditingEngine defaulted to a
RegularEditingEngine for a new Editor, even if Vim Emulation had been
selected in the existing Editor.
This commit is contained in:
scwfri 2021-12-08 16:28:12 -06:00 committed by Andreas Kling
parent fa94978a7e
commit 8d0143a380
2 changed files with 26 additions and 6 deletions

View file

@ -54,7 +54,12 @@ MainWidget::MainWidget()
m_editor = *find_descendant_of_type_named<GUI::TextEditor>("editor");
m_editor->set_ruler_visible(true);
m_editor->set_automatic_indentation_enabled(true);
m_editor->set_editing_engine(make<GUI::RegularEditingEngine>());
if (m_editor->editing_engine()->is_regular())
m_editor->set_editing_engine(make<GUI::RegularEditingEngine>());
else if (m_editor->editing_engine()->is_vim())
m_editor->set_editing_engine(make<GUI::VimEditingEngine>());
else
VERIFY_NOT_REACHED();
m_editor->on_change = [this] {
update_preview();