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
Notes: sideshowbarker 2024-07-19 17:11:50 +09:00
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();