summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorthankyouverycool <66646555+thankyouverycool@users.noreply.github.com>2022-02-26 15:28:55 -0500
committerAndreas Kling <kling@serenityos.org>2022-02-26 22:54:25 +0100
commit76157594a9cc3931a2a2cff09cffe47e0dc9a0fc (patch)
treec20444d7eaf51cafb511470c303f54dc093629b5 /Userland/Applications
parente5f7032fb8e8e6eb55d7546859d5917718739a47 (diff)
downloadserenity-76157594a9cc3931a2a2cff09cffe47e0dc9a0fc.zip
TextEditor: Save wrapping mode settings
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/TextEditor/MainWidget.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Userland/Applications/TextEditor/MainWidget.cpp b/Userland/Applications/TextEditor/MainWidget.cpp
index b2a8a5c36f..649339afb1 100644
--- a/Userland/Applications/TextEditor/MainWidget.cpp
+++ b/Userland/Applications/TextEditor/MainWidget.cpp
@@ -463,12 +463,15 @@ void MainWidget::initialize_menubar(GUI::Window& window)
auto& wrapping_mode_menu = view_menu.add_submenu("&Wrapping Mode");
m_no_wrapping_action = GUI::Action::create_checkable("&No Wrapping", [&](auto&) {
m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap);
+ Config::write_string("TextEditor", "View", "WrappingMode", "None");
});
m_wrap_anywhere_action = GUI::Action::create_checkable("Wrap &Anywhere", [&](auto&) {
m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::WrapAnywhere);
+ Config::write_string("TextEditor", "View", "WrappingMode", "Anywhere");
});
m_wrap_at_words_action = GUI::Action::create_checkable("Wrap at &Words", [&](auto&) {
m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::WrapAtWords);
+ Config::write_string("TextEditor", "View", "WrappingMode", "Words");
});
m_wrapping_mode_actions.add_action(*m_no_wrapping_action);
@@ -479,7 +482,17 @@ void MainWidget::initialize_menubar(GUI::Window& window)
wrapping_mode_menu.add_action(*m_wrap_anywhere_action);
wrapping_mode_menu.add_action(*m_wrap_at_words_action);
- m_no_wrapping_action->set_checked(true);
+ auto word_wrap = Config::read_string("TextEditor", "View", "WrappingMode", "Words");
+ if (word_wrap == "None") {
+ m_no_wrapping_action->set_checked(true);
+ m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::NoWrap);
+ } else if (word_wrap == "Anywhere") {
+ m_wrap_anywhere_action->set_checked(true);
+ m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::WrapAnywhere);
+ } else {
+ m_wrap_at_words_action->set_checked(true);
+ m_editor->set_wrapping_mode(GUI::TextEditor::WrappingMode::WrapAtWords);
+ }
m_soft_tab_width_actions.set_exclusive(true);
auto& soft_tab_width_menu = view_menu.add_submenu("&Tab Width");