chore: run cargo fmt

This commit is contained in:
Stevan Freeborn
2026-01-25 17:26:40 -06:00
parent 2c098b23b7
commit db0cd51818
8 changed files with 355 additions and 348 deletions
+49 -49
View File
@@ -7,75 +7,75 @@ use iced::Task;
use iced::widget::text_editor;
pub fn edit(state: &mut State, action: text_editor::Action) -> Task<Message> {
state.apply_edit(action);
Task::none()
state.apply_edit(action);
Task::none()
}
pub fn switch_tab(state: &mut State, index: usize) -> Task<Message> {
state.switch_tab(index);
Task::none()
state.switch_tab(index);
Task::none()
}
pub fn link_clicked(url: String) -> Task<Message> {
println!("Opening link: {}", url);
Task::none()
println!("Opening link: {}", url);
Task::none()
}
pub fn file_action(state: &mut State, action: FileAction) -> Task<Message> {
match action {
FileAction::New => {
state.new_file();
Task::none()
}
FileAction::Close(index) => {
if state.close_file(index) {
iced::exit()
} else {
Task::none()
}
}
FileAction::Open => Task::perform(io::open_file(), Message::FileOpened),
FileAction::Save => {
let (current_path, content) = state.active_file_data();
let path = current_path.cloned();
Task::perform(io::save_file(path, content), Message::FileSaved)
}
FileAction::SaveAs => {
let (_, content) = state.active_file_data();
Task::perform(io::save_file(None, content), Message::FileSaved)
}
match action {
FileAction::New => {
state.new_file();
Task::none()
}
FileAction::Close(index) => {
if state.close_file(index) {
iced::exit()
} else {
Task::none()
}
}
FileAction::Open => Task::perform(io::open_file(), Message::FileOpened),
FileAction::Save => {
let (current_path, content) = state.active_file_data();
let path = current_path.cloned();
Task::perform(io::save_file(path, content), Message::FileSaved)
}
FileAction::SaveAs => {
let (_, content) = state.active_file_data();
Task::perform(io::save_file(None, content), Message::FileSaved)
}
}
}
pub fn opened_file(state: &mut State, result: Result<(PathBuf, String), String>) -> Task<Message> {
match result {
Ok((path, content)) => {
state.open_file(path, content);
}
Err(_error) => {}
};
match result {
Ok((path, content)) => {
state.open_file(path, content);
}
Err(_error) => {}
};
Task::none()
Task::none()
}
pub fn saved_file(state: &mut State, result: Result<PathBuf, String>) -> Task<Message> {
match result {
Ok(path) => {
state.set_active_file_path(path);
}
Err(_error) => {}
};
match result {
Ok(path) => {
state.set_active_file_path(path);
}
Err(_error) => {}
};
Task::none()
Task::none()
}
pub fn view_action(state: &mut State, action: ViewAction) -> Task<Message> {
match action {
ViewAction::Increase => state.increase_font(),
ViewAction::Decrease => state.decrease_font(),
ViewAction::Reset => state.reset_font(),
ViewAction::TogglePreview => state.toggle_preview(),
}
match action {
ViewAction::Increase => state.increase_font(),
ViewAction::Decrease => state.decrease_font(),
ViewAction::Reset => state.reset_font(),
ViewAction::TogglePreview => state.toggle_preview(),
}
Task::none()
Task::none()
}