diff --git a/Cargo.toml b/Cargo.toml index 3020513..f89b127 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,9 +2,9 @@ name = "cosmic-edit" version = "0.1.0" authors = ["Jeremy Soller "] -edition = "2021" +edition = "2024" license = "GPL-3.0-only" -rust-version = "1.71" +rust-version = "1.85" [build-dependencies] vergen = { version = "8", features = ["git", "gitcl"] } diff --git a/src/config.rs b/src/config.rs index 35650a6..c5cea7f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only use cosmic::{ - cosmic_config::{self, cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry}, + cosmic_config::{self, CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry}, theme, }; use cosmic_text::Metrics; diff --git a/src/localize.rs b/src/localize.rs index 70272fb..d7d9ce5 100644 --- a/src/localize.rs +++ b/src/localize.rs @@ -4,8 +4,8 @@ use std::str::FromStr; use std::sync::OnceLock; use i18n_embed::{ - fluent::{fluent_language_loader, FluentLanguageLoader}, DefaultLocalizer, LanguageLoader, Localizer, + fluent::{FluentLanguageLoader, fluent_language_loader}, }; use icu_collator::{Collator, CollatorOptions, Numeric}; use icu_provider::DataLocale; diff --git a/src/main.rs b/src/main.rs index 20a2f0d..2bf292d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,22 +5,21 @@ use cosmic::widget::menu::action::MenuAction; use cosmic::widget::menu::key_bind::KeyBind; use cosmic::widget::segmented_button::Entity; use cosmic::{ - action, - app::{context_drawer, Core, Settings, Task}, + Application, ApplicationExt, Apply, Element, action, + app::{Core, Settings, Task, context_drawer}, cosmic_config::{self, CosmicConfigEntry}, cosmic_theme, executor, font::Font, iced::{ - self, + self, Alignment, Background, Color, Length, Limits, Point, Subscription, advanced::graphics::text::font_system, clipboard, event, futures::{self, SinkExt}, keyboard::{self, Modifiers}, - stream, window, Alignment, Background, Color, Length, Limits, Point, Subscription, + stream, window, }, style, theme, widget::{self, button, icon, nav_bar, segmented_button}, - Application, ApplicationExt, Apply, Element, }; use cosmic_files::{ dialog::{Dialog, DialogKind, DialogMessage, DialogResult, DialogSettings}, @@ -38,7 +37,7 @@ use std::{ }; use tokio::time; -use config::{AppTheme, Config, ConfigState, CONFIG_VERSION}; +use config::{AppTheme, CONFIG_VERSION, Config, ConfigState}; mod config; use git::{GitDiff, GitDiffLine, GitRepository, GitStatus, GitStatusKind}; @@ -911,24 +910,26 @@ impl App { }); } - widget::settings::view_column(vec![widget::settings::section() - .add( - widget::settings::item::builder(fl!("word-count")) - .control(widget::text(word_count.to_string())), - ) - .add( - widget::settings::item::builder(fl!("character-count")) - .control(widget::text(character_count.to_string())), - ) - .add( - widget::settings::item::builder(fl!("character-count-no-spaces")) - .control(widget::text(character_count_no_spaces.to_string())), - ) - .add( - widget::settings::item::builder(fl!("line-count")) - .control(widget::text(line_count.to_string())), - ) - .into()]) + widget::settings::view_column(vec![ + widget::settings::section() + .add( + widget::settings::item::builder(fl!("word-count")) + .control(widget::text(word_count.to_string())), + ) + .add( + widget::settings::item::builder(fl!("character-count")) + .control(widget::text(character_count.to_string())), + ) + .add( + widget::settings::item::builder(fl!("character-count-no-spaces")) + .control(widget::text(character_count_no_spaces.to_string())), + ) + .add( + widget::settings::item::builder(fl!("line-count")) + .control(widget::text(line_count.to_string())), + ) + .into(), + ]) .into() } @@ -1182,10 +1183,12 @@ impl App { items } None => { - vec![search_input - .on_input(Message::ProjectSearchValue) - .on_submit(|_| Message::ProjectSearchSubmit) - .into()] + vec![ + search_input + .on_input(Message::ProjectSearchValue) + .on_submit(|_| Message::ProjectSearchSubmit) + .into(), + ] } }; diff --git a/src/menu.rs b/src/menu.rs index 3f7b225..6012c82 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -1,22 +1,22 @@ // SPDX-License-Identifier: GPL-3.0-only -use cosmic::widget::menu::key_bind::KeyBind; use cosmic::widget::menu::Item as MenuItem; +use cosmic::widget::menu::key_bind::KeyBind; use cosmic::{ + Element, app::Core, - iced::{advanced::widget::text::Style as TextStyle, widget::column, Background, Length}, + iced::{Background, Length, advanced::widget::text::Style as TextStyle, widget::column}, iced_core::Border, theme, widget::{ self, divider, horizontal_space, - menu::{menu_button, ItemHeight, ItemWidth}, + menu::{ItemHeight, ItemWidth, menu_button}, responsive_menu_bar, segmented_button, }, - Element, }; use std::{collections::HashMap, path::PathBuf, sync::LazyLock}; -use crate::{fl, Action, Config, ConfigState, Message}; +use crate::{Action, Config, ConfigState, Message, fl}; static MENU_ID: LazyLock = LazyLock::new(|| cosmic::widget::Id::new("responsive-menu")); diff --git a/src/search.rs b/src/search.rs index f7cbcc2..7013cf8 100644 --- a/src/search.rs +++ b/src/search.rs @@ -2,7 +2,7 @@ use grep::matcher::{Match, Matcher}; use grep::regex::RegexMatcher; -use grep::searcher::{sinks::UTF8, Searcher}; +use grep::searcher::{Searcher, sinks::UTF8}; use std::path::PathBuf; #[derive(Clone, Debug, Eq, PartialEq)] diff --git a/src/tab.rs b/src/tab.rs index bb59ff7..a1ac72c 100644 --- a/src/tab.rs +++ b/src/tab.rs @@ -1,10 +1,10 @@ // SPDX-License-Identifier: GPL-3.0-only use cosmic::{ - iced::{advanced::graphics::text::font_system, Point}, + iced::{Point, advanced::graphics::text::font_system}, widget::icon, }; -use cosmic_files::mime_icon::{mime_for_path, mime_icon, FALLBACK_MIME_ICON}; +use cosmic_files::mime_icon::{FALLBACK_MIME_ICON, mime_for_path, mime_icon}; use cosmic_text::{Attrs, Buffer, Cursor, Edit, Selection, Shaping, SyntaxEditor, ViEditor, Wrap}; use notify::Watcher; use regex::Regex; @@ -16,7 +16,7 @@ use std::{ sync::{Arc, Mutex}, }; -use crate::{fl, git::GitDiff, Config, SYNTAX_SYSTEM}; +use crate::{Config, SYNTAX_SYSTEM, fl, git::GitDiff}; pub enum Tab { Editor(EditorTab), diff --git a/src/text_box.rs b/src/text_box.rs index 0414daf..736219a 100644 --- a/src/text_box.rs +++ b/src/text_box.rs @@ -1,29 +1,29 @@ // SPDX-License-Identifier: GPL-3.0-only use cosmic::{ - cosmic_theme::palette::{blend::Compose, WithAlpha}, + Renderer, + cosmic_theme::palette::{WithAlpha, blend::Compose}, iced::{ + Color, Element, Length, Padding, Point, Rectangle, Size, Vector, advanced::graphics::text::font_system, event::{Event, Status}, keyboard::{Event as KeyEvent, Modifiers}, mouse::{self, Button, Event as MouseEvent, ScrollDelta}, - Color, Element, Length, Padding, Point, Rectangle, Size, Vector, }, iced_core::{ + Border, Radians, Shell, clipboard::Clipboard, image, - keyboard::{key::Named, Key}, + keyboard::{Key, key::Named}, layout::{self, Layout}, renderer::{self, Quad, Renderer as _}, widget::{ - self, + self, Id, Widget, operation::{self, Operation}, - tree, Id, Widget, + tree, }, - Border, Radians, Shell, }, theme::Theme, - Renderer, }; use cosmic_text::{ Action, BorrowedWithFontSystem, Edit, Metrics, Motion, Scroll, Selection, ViEditor, @@ -35,7 +35,7 @@ use std::{ time::{Duration, Instant}, }; -use crate::{line_number::LineNumberKey, LINE_NUMBER_CACHE, SWASH_CACHE}; +use crate::{LINE_NUMBER_CACHE, SWASH_CACHE, line_number::LineNumberKey}; pub struct TextBox<'a, Message> { editor: &'a Mutex>,