1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:07:36 +00:00

HackStudio: Make wrapping modes consistent

We were only setting the wrapping mode when triggering the action. So:
- Any editors open without triggering a wrapping-mode action would have
  the default (WrapAtWords) instead of the selected item (NoWrap).
- Any editors opened after triggering an action would have the default
  too.

This fixes both situations, by:
- Storing the current wrapping mode in `m_wrapping_mode`. Later this
  could be loaded from the config.
- Changing that value any time a wrapping-mode action is triggered.
- Setting the wrapping mode on newly-created editors.
This commit is contained in:
Sam Atkins 2023-02-19 16:47:18 +00:00 committed by Andreas Kling
parent bb8c8a67dc
commit 307cd4a1da
2 changed files with 16 additions and 1 deletions

View file

@ -253,6 +253,7 @@ private:
RefPtr<Gfx::Font> m_editor_font;
RefPtr<GUI::Action> m_editor_font_action;
GUI::TextEditor::WrappingMode m_wrapping_mode { GUI::TextEditor::NoWrap };
GUI::ActionGroup m_wrapping_mode_actions;
RefPtr<GUI::Action> m_no_wrapping_action;
RefPtr<GUI::Action> m_wrap_anywhere_action;