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:
+7
-2
@@ -12,7 +12,7 @@ mod state;
|
||||
use iced::theme::Palette;
|
||||
use iced::widget::column;
|
||||
use iced::window::icon;
|
||||
use iced::{Color, Theme};
|
||||
use iced::{Color, Length, Theme};
|
||||
use iced::{Element, Subscription, Task, event};
|
||||
use iced::{keyboard, window};
|
||||
|
||||
@@ -84,7 +84,12 @@ fn view(state: &State, _id: iced::window::Id) -> Element<'_, Message> {
|
||||
column![
|
||||
components::tabs::view(state.files(), state.current_file_index()),
|
||||
components::action_bar::view(state.selected_file_action(), state.selected_view_action()),
|
||||
components::editor::view(current_file, state.mode(), state.font_size()),
|
||||
components::editor::view(
|
||||
current_file,
|
||||
state.mode(),
|
||||
state.font_size(),
|
||||
state.is_word_wrap_on()
|
||||
),
|
||||
components::status_bar::view(current_file),
|
||||
]
|
||||
.into()
|
||||
|
||||
Reference in New Issue
Block a user