feat: add word wrap toggle functionality

Add the ability to toggle word wrap in the text editor with Alt+Z.
Word wrap can be enabled or disabled, affecting how long lines are
displayed in edit mode.

Changes:
- Add `is_word_wrap_on` state field with default value of false
- Implement `toggle_word_wrap()` and `is_word_wrap_on()` methods
- Add ToggleWordWrap variant to ViewAction enum
- Bind Alt+Z keyboard shortcut to toggle word wrap
- Refactor editor view to support dynamic wrapping behavior
  - Use responsive widget when wrap is enabled to constrain width
  - Apply Wrapping::WordOrGlyph when enabled, Wrapping::None otherwise
- Update editor view signature to accept word wrap state parameter
- Fix indentation inconsistencies in file.rs and state.rs
This commit is contained in:
Stevan Freeborn
2026-02-25 17:17:34 -06:00
parent 7462943c04
commit b382f14a55
7 changed files with 97 additions and 44 deletions
+4 -4
View File
@@ -93,12 +93,12 @@ impl File {
.map(|p| p.to_string_lossy().to_string())
.unwrap_or_default()
}
pub fn needs_saving(&self) -> bool {
self.needs_saving
pub fn needs_saving(&self) -> bool {
self.needs_saving
}
pub fn set_needs_saving(&mut self, state: bool) {
self.needs_saving = state
self.needs_saving = state
}
}