TextEditorWidget: Whitespace related options

This commit is contained in:
lucastarche 2021-03-17 13:52:54 -03:00 committed by Andreas Kling
parent 6d3d097832
commit 115348147d
Notes: sideshowbarker 2024-07-18 21:05:53 +09:00
2 changed files with 23 additions and 0 deletions

View File

@ -500,6 +500,12 @@ void TextEditorWidget::initialize_menubar(GUI::MenuBar& menubar)
m_editor->set_soft_tab_width(16);
});
m_soft_tab_width_actions.add_action(*m_soft_tab_1_width_action);
m_soft_tab_width_actions.add_action(*m_soft_tab_2_width_action);
m_soft_tab_width_actions.add_action(*m_soft_tab_4_width_action);
m_soft_tab_width_actions.add_action(*m_soft_tab_8_width_action);
m_soft_tab_width_actions.add_action(*m_soft_tab_16_width_action);
soft_tab_width_menu.add_action(*m_soft_tab_1_width_action);
soft_tab_width_menu.add_action(*m_soft_tab_2_width_action);
soft_tab_width_menu.add_action(*m_soft_tab_4_width_action);
@ -508,6 +514,20 @@ void TextEditorWidget::initialize_menubar(GUI::MenuBar& menubar)
m_soft_tab_4_width_action->set_checked(true);
view_menu.add_separator();
m_visualize_trailing_whitespace_action = GUI::Action::create_checkable("Visualize trailing whitespace", [&](auto&) {
m_editor->set_visualize_trailing_whitespace(m_visualize_trailing_whitespace_action->is_checked());
});
m_visualize_leading_whitespace_action = GUI::Action::create_checkable("Visualize leading whitespace", [&](auto&) {
m_editor->set_visualize_leading_whitespace(m_visualize_leading_whitespace_action->is_checked());
});
m_visualize_trailing_whitespace_action->set_checked(true);
view_menu.add_action(*m_visualize_trailing_whitespace_action);
view_menu.add_action(*m_visualize_leading_whitespace_action);
view_menu.add_separator();
view_menu.add_action(*m_no_preview_action);
view_menu.add_action(*m_markdown_preview_action);

View File

@ -114,6 +114,9 @@ private:
RefPtr<GUI::Action> m_wrap_anywhere_action;
RefPtr<GUI::Action> m_wrap_at_words_action;
RefPtr<GUI::Action> m_visualize_trailing_whitespace_action;
RefPtr<GUI::Action> m_visualize_leading_whitespace_action;
GUI::ActionGroup m_soft_tab_width_actions;
RefPtr<GUI::Action> m_soft_tab_1_width_action;
RefPtr<GUI::Action> m_soft_tab_2_width_action;