From 36fb454a3ba94363bf979f9892967b052975a33e Mon Sep 17 00:00:00 2001 From: Axel Kappel <69117984+Kl4rry@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:57:58 +0200 Subject: [PATCH] rename utility to ferrite-utility --- Cargo.lock | 26 +++---- Cargo.toml | 78 +++++++++---------- ferrite-core/Cargo.toml | 6 +- ferrite-core/src/buffer.rs | 6 +- ferrite-core/src/buffer/buffer_tests.rs | 2 +- ferrite-core/src/buffer/format.rs | 2 +- ferrite-core/src/buffer/history.rs | 2 +- ferrite-core/src/buffer/search.rs | 2 +- ferrite-core/src/buffer/write.rs | 2 +- ferrite-core/src/indent.rs | 2 +- ferrite-core/src/keymap.rs | 2 +- ferrite-core/src/palette.rs | 2 +- ferrite-core/src/palette/cmd.rs | 2 +- ferrite-core/src/palette/cmd_parser.rs | 2 +- ferrite-core/src/palette/completer.rs | 2 +- ferrite-core/src/search_buffer.rs | 2 +- ferrite-core/src/workspace.rs | 2 +- ferrite-tui/Cargo.toml | 2 +- ferrite-tui/src/lib.rs | 2 +- ferrite-tui/src/widgets/editor_widget.rs | 8 +- ferrite-tui/src/widgets/search_widget.rs | 2 +- {utility => ferrite-utility}/Cargo.toml | 2 +- {utility => ferrite-utility}/src/chars.rs | 0 {utility => ferrite-utility}/src/graphemes.rs | 0 {utility => ferrite-utility}/src/lib.rs | 0 .../src/line_ending.rs | 0 {utility => ferrite-utility}/src/point.rs | 0 27 files changed, 79 insertions(+), 79 deletions(-) rename {utility => ferrite-utility}/Cargo.toml (92%) rename {utility => ferrite-utility}/src/chars.rs (100%) rename {utility => ferrite-utility}/src/graphemes.rs (100%) rename {utility => ferrite-utility}/src/lib.rs (100%) rename {utility => ferrite-utility}/src/line_ending.rs (100%) rename {utility => ferrite-utility}/src/point.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 5ad0b5d..e4f088d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -590,6 +590,7 @@ dependencies = [ "dunce", "encoding_rs", "ferrite-tree-sitter", + "ferrite-utility", "flume", "heck 0.5.0", "humansize", @@ -614,7 +615,6 @@ dependencies = [ "tree_magic_mini", "unicode-segmentation", "unicode-width", - "utility", ] [[package]] @@ -652,6 +652,7 @@ dependencies = [ "encoding_rs", "ferrite-cli", "ferrite-core", + "ferrite-utility", "ratatui", "rayon", "ropey", @@ -659,7 +660,17 @@ dependencies = [ "subprocess", "tracing", "unicode-width", - "utility", +] + +[[package]] +name = "ferrite-utility" +version = "0.1.0" +dependencies = [ + "num-traits", + "ropey", + "unicode-general-category", + "unicode-segmentation", + "unicode-width", ] [[package]] @@ -2178,17 +2189,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "utility" -version = "0.1.0" -dependencies = [ - "num-traits", - "ropey", - "unicode-general-category", - "unicode-segmentation", - "unicode-width", -] - [[package]] name = "valuable" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 1c173ab..9b10011 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,50 +9,50 @@ anyhow = "1.0.68" arboard = "3.2.0" bitflags = "2.5.0" blake3 = "1.5.1" -cb = { package = "crossbeam-channel", version = "0.5.8"} +cb = {package = "crossbeam-channel", version = "0.5.8"} cc = "1.0.79" chardetng = "0.1.17" -clap = { version = "4.1.4", features = ["derive", "cargo"] } +clap = {version = "4.1.4", features = ["derive", "cargo"]} crossterm = "0.25.0" # Pinned to 0.25.0 because emoji are broken in newer versions -csscolorparser = { version = "0.6.2", features = ["rgb"] } -detect-indent = { git = "https://github.com/stefanpenner/detect-indent-rs", rev = "f645bcc" } +csscolorparser = {version = "0.6.2", features = ["rgb"]} +detect-indent = {git = "https://github.com/stefanpenner/detect-indent-rs", rev = "f645bcc"} directories = "5.0.0" dunce = "1.0.4" encoding_rs = "0.8.31" -ferrite-cli = { path = "ferrite-cli" } -ferrite-core = { path = "ferrite-core" } -ferrite-tui = { path = "ferrite-tui" } -ferrite-tree-sitter = {path = "ferrite-tree-sitter" } -flume = { version = "0.11.0", default-features = false } -heck = "0.5.0" -humansize = "2.1.3" -ignore = "0.4.20" -include_dir = "0.7.3" -lexical-sort = "0.3.1" -memchr = "2.5.0" -notify = "6.0.0" -num-traits = "0.2.15" -once_cell = "1.17.1" -rayon = "1.7.0" -ropey = "1.5.1" -serde = "1.0.152" -serde_json = "1.0.115" -slab = "0.4.8" -sublime_fuzzy = "0.7.0" -subprocess = "0.2.9" -tempdir = "0.3.7" -toml = "0.7.1" -tracing = "0.1.40" -tracing-log = "0.2.0" -tracing-subscriber = "0.3.18" -trash = "4.0.0" -tree_magic_mini = "3.0.3" -tree-sitter = "0.20.10" -tui = { package = "ratatui", version = "0.26.0" } -unicode-general-category = "0.6.0" -unicode-segmentation = "1.10.0" -unicode-width = "0.1.10" -utility = {path = "utility"} +ferrite-cli = {path = "ferrite-cli"} +ferrite-core = {path = "ferrite-core"} +ferrite-tree-sitter = {path = "ferrite-tree-sitter"} +ferrite-tui = {path = "ferrite-tui"} +ferrite-utility = {path = "ferrite-utility"} +flume = {version = "0.11.0", default-features = false} +heck = "0.5.0" +humansize = "2.1.3" +ignore = "0.4.20" +include_dir = "0.7.3" +lexical-sort = "0.3.1" +memchr = "2.5.0" +notify = "6.0.0" +num-traits = "0.2.15" +once_cell = "1.17.1" +rayon = "1.7.0" +ropey = "1.5.1" +serde = "1.0.152" +serde_json = "1.0.115" +slab = "0.4.8" +sublime_fuzzy = "0.7.0" +subprocess = "0.2.9" +tempdir = "0.3.7" +toml = "0.7.1" +tracing = "0.1.40" +tracing-log = "0.2.0" +tracing-subscriber = "0.3.18" +trash = "4.0.0" +tree-sitter = "0.20.10" +tree_magic_mini = "3.0.3" +tui = {package = "ratatui", version = "0.26.0"} +unicode-general-category = "0.6.0" +unicode-segmentation = "1.10.0" +unicode-width = "0.1.10" [dependencies] anyhow.workspace = true @@ -70,7 +70,7 @@ tracing.workspace = true opt-level = 3 [workspace] -members = ["ferrite-cli", "ferrite-core", "ferrite-tui", "ferrite-tree-sitter", "utility"] +members = ["ferrite-cli", "ferrite-core", "ferrite-tui", "ferrite-tree-sitter", "ferrite-utility"] [[bin]] name = "fe" diff --git a/ferrite-core/Cargo.toml b/ferrite-core/Cargo.toml index 7ea83d1..ada4eec 100644 --- a/ferrite-core/Cargo.toml +++ b/ferrite-core/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" [dependencies] anyhow.workspace = true arboard.workspace = true -blake3.workspace = true bitflags.workspace = true +blake3.workspace = true cb.workspace = true chardetng.workspace = true csscolorparser = { workspace = true, features = ["rgb"] } @@ -16,6 +16,7 @@ directories.workspace = true dunce.workspace = true encoding_rs.workspace = true ferrite-tree-sitter.workspace = true +ferrite-utility.workspace = true flume = { workspace = true, default-features = false } heck.workspace = true humansize.workspace = true @@ -35,9 +36,8 @@ subprocess.workspace = true toml.workspace = true tracing.workspace = true trash.workspace = true -tree-sitter.workspace = true tree_magic_mini = { workspace = true, features = ["with-gpl-data"] } -utility.workspace = true +tree-sitter.workspace = true unicode-segmentation.workspace = true unicode-width.workspace = true diff --git a/ferrite-core/src/buffer.rs b/ferrite-core/src/buffer.rs index 1ee89ca..55a311c 100644 --- a/ferrite-core/src/buffer.rs +++ b/ferrite-core/src/buffer.rs @@ -9,13 +9,13 @@ use std::{ }; use encoding_rs::Encoding; -use ropey::{Rope, RopeSlice}; -use serde::{Deserialize, Serialize}; -use utility::{ +use ferrite_utility::{ graphemes::RopeGraphemeExt as _, line_ending::{rope_end_without_line_ending, LineEnding, DEFAULT_LINE_ENDING}, point::Point, }; +use ropey::{Rope, RopeSlice}; +use serde::{Deserialize, Serialize}; use self::{error::BufferError, history::History, search::BufferSearcher}; use super::{ diff --git a/ferrite-core/src/buffer/buffer_tests.rs b/ferrite-core/src/buffer/buffer_tests.rs index 8ed2f63..a19ad64 100644 --- a/ferrite-core/src/buffer/buffer_tests.rs +++ b/ferrite-core/src/buffer/buffer_tests.rs @@ -1,7 +1,7 @@ use std::fs; +use ferrite_utility::line_ending::DEFAULT_LINE_ENDING; use tempdir::TempDir; -use utility::line_ending::DEFAULT_LINE_ENDING; use super::{read, write}; diff --git a/ferrite-core/src/buffer/format.rs b/ferrite-core/src/buffer/format.rs index 26f3170..01b8feb 100644 --- a/ferrite-core/src/buffer/format.rs +++ b/ferrite-core/src/buffer/format.rs @@ -1,8 +1,8 @@ use std::time::Duration; +use ferrite_utility::graphemes::ensure_grapheme_boundary_next_byte; use ropey::Rope; use subprocess::{Exec, PopenError, Redirection}; -use utility::graphemes::ensure_grapheme_boundary_next_byte; use super::{Buffer, Cursor}; diff --git a/ferrite-core/src/buffer/history.rs b/ferrite-core/src/buffer/history.rs index 021cc28..aa500cc 100644 --- a/ferrite-core/src/buffer/history.rs +++ b/ferrite-core/src/buffer/history.rs @@ -1,7 +1,7 @@ use std::{mem, ops::Range}; +use ferrite_utility::graphemes::ensure_grapheme_boundary_next_byte; use ropey::Rope; -use utility::graphemes::ensure_grapheme_boundary_next_byte; use super::Cursor; diff --git a/ferrite-core/src/buffer/search.rs b/ferrite-core/src/buffer/search.rs index 8efa4d3..38ffcd3 100644 --- a/ferrite-core/src/buffer/search.rs +++ b/ferrite-core/src/buffer/search.rs @@ -3,8 +3,8 @@ use std::{ thread, }; +use ferrite_utility::{graphemes::RopeGraphemeExt as _, point::Point}; use ropey::Rope; -use utility::{graphemes::RopeGraphemeExt as _, point::Point}; use crate::event_loop_proxy::EventLoopProxy; diff --git a/ferrite-core/src/buffer/write.rs b/ferrite-core/src/buffer/write.rs index 33a3d17..9e98d74 100644 --- a/ferrite-core/src/buffer/write.rs +++ b/ferrite-core/src/buffer/write.rs @@ -5,8 +5,8 @@ use std::{ }; use encoding_rs::{CoderResult, Encoding}; +use ferrite_utility::{graphemes::RopeGraphemeExt, line_ending::LineEnding}; use ropey::{Rope, RopeBuilder}; -use utility::{graphemes::RopeGraphemeExt, line_ending::LineEnding}; use super::error::BufferError; diff --git a/ferrite-core/src/indent.rs b/ferrite-core/src/indent.rs index e60e2e7..3112f75 100644 --- a/ferrite-core/src/indent.rs +++ b/ferrite-core/src/indent.rs @@ -1,8 +1,8 @@ use std::num::NonZeroUsize; use detect_indent::IndentKind; +use ferrite_utility::graphemes::TAB_WIDTH; use ropey::RopeSlice; -use utility::graphemes::TAB_WIDTH; #[derive(Debug, Clone, Copy)] pub enum Indentation { diff --git a/ferrite-core/src/keymap.rs b/ferrite-core/src/keymap.rs index bb967b0..a06a009 100644 --- a/ferrite-core/src/keymap.rs +++ b/ferrite-core/src/keymap.rs @@ -1,4 +1,4 @@ -use utility::point::Point; +use ferrite_utility::point::Point; pub mod keycode; use keycode::{KeyCode, KeyModifiers}; diff --git a/ferrite-core/src/palette.rs b/ferrite-core/src/palette.rs index 5608ba1..d98394b 100644 --- a/ferrite-core/src/palette.rs +++ b/ferrite-core/src/palette.rs @@ -1,7 +1,7 @@ use std::fmt::{self, Display}; +use ferrite_utility::{graphemes::RopeGraphemeExt, line_ending::LineEnding}; use ropey::RopeSlice; -use utility::{graphemes::RopeGraphemeExt, line_ending::LineEnding}; use self::completer::{Completer, CompleterContext}; use super::buffer::{error::BufferError, Buffer}; diff --git a/ferrite-core/src/palette/cmd.rs b/ferrite-core/src/palette/cmd.rs index c70f7f1..b535b7c 100644 --- a/ferrite-core/src/palette/cmd.rs +++ b/ferrite-core/src/palette/cmd.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use utility::line_ending::LineEnding; +use ferrite_utility::line_ending::LineEnding; use crate::{buffer::case::Case, panes::Direction}; diff --git a/ferrite-core/src/palette/cmd_parser.rs b/ferrite-core/src/palette/cmd_parser.rs index eb8963e..bc8c61f 100644 --- a/ferrite-core/src/palette/cmd_parser.rs +++ b/ferrite-core/src/palette/cmd_parser.rs @@ -1,5 +1,5 @@ +use ferrite_utility::line_ending::LineEnding; use once_cell::sync::Lazy; -use utility::line_ending::LineEnding; use self::generic_cmd::{CommandTemplate, CommandTemplateArg}; use super::cmd::Command; diff --git a/ferrite-core/src/palette/completer.rs b/ferrite-core/src/palette/completer.rs index 3fb8100..bb8fb34 100644 --- a/ferrite-core/src/palette/completer.rs +++ b/ferrite-core/src/palette/completer.rs @@ -1,6 +1,6 @@ use std::{borrow::Cow, collections::HashMap, path::PathBuf}; -use utility::line_ending::LineEnding; +use ferrite_utility::line_ending::LineEnding; use self::path_completer::complete_file_path; use super::cmd_parser::{ diff --git a/ferrite-core/src/search_buffer.rs b/ferrite-core/src/search_buffer.rs index ec37b55..8ac27ba 100644 --- a/ferrite-core/src/search_buffer.rs +++ b/ferrite-core/src/search_buffer.rs @@ -1,8 +1,8 @@ use std::{borrow::Cow, sync::Arc, thread}; use cb::select; +use ferrite_utility::{graphemes::RopeGraphemeExt, line_ending::LineEnding}; use ropey::RopeSlice; -use utility::{graphemes::RopeGraphemeExt, line_ending::LineEnding}; use self::fuzzy_match::FuzzyMatch; use super::buffer::{error::BufferError, Buffer}; diff --git a/ferrite-core/src/workspace.rs b/ferrite-core/src/workspace.rs index 2df9497..10b2eff 100644 --- a/ferrite-core/src/workspace.rs +++ b/ferrite-core/src/workspace.rs @@ -4,9 +4,9 @@ use std::{ }; use anyhow::Result; +use ferrite_utility::graphemes::RopeGraphemeExt; use serde::{Deserialize, Serialize}; use slab::Slab; -use utility::graphemes::RopeGraphemeExt; use super::buffer::{Buffer, Cursor}; use crate::panes::{PaneKind, Panes}; diff --git a/ferrite-tui/Cargo.toml b/ferrite-tui/Cargo.toml index 51923ba..d591a4d 100644 --- a/ferrite-tui/Cargo.toml +++ b/ferrite-tui/Cargo.toml @@ -17,4 +17,4 @@ subprocess.workspace = true tracing.workspace = true tui.workspace = true unicode-width.workspace = true -utility.workspace = true \ No newline at end of file +ferrite-utility.workspace = true \ No newline at end of file diff --git a/ferrite-tui/src/lib.rs b/ferrite-tui/src/lib.rs index 7f3c88f..b3d8199 100644 --- a/ferrite-tui/src/lib.rs +++ b/ferrite-tui/src/lib.rs @@ -35,11 +35,11 @@ use ferrite_core::{ theme::EditorTheme, workspace::Workspace, }; +use ferrite_utility::{line_ending, point::Point}; use glue::{ferrite_to_tui_rect, tui_to_ferrite_rect}; use slab::Slab; use subprocess::{Exec, Redirection}; use tui::layout::{Margin, Position, Rect}; -use utility::{line_ending, point::Point}; use self::{ event_loop::{TuiEvent, TuiEventLoop, TuiEventLoopControlFlow, TuiEventLoopProxy}, diff --git a/ferrite-tui/src/widgets/editor_widget.rs b/ferrite-tui/src/widgets/editor_widget.rs index 382c719..f8238a5 100644 --- a/ferrite-tui/src/widgets/editor_widget.rs +++ b/ferrite-tui/src/widgets/editor_widget.rs @@ -4,16 +4,16 @@ use ferrite_core::{ language::syntax::{Highlight, HighlightEvent}, theme::EditorTheme, }; +use ferrite_utility::{ + graphemes::{tab_width_at, RopeGraphemeExt, TAB_WIDTH}, + point::Point, +}; use rayon::prelude::{IntoParallelRefIterator, ParallelIterator}; use ropey::RopeSlice; use tui::{ layout::Rect, widgets::{StatefulWidget, Widget}, }; -use utility::{ - graphemes::{tab_width_at, RopeGraphemeExt, TAB_WIDTH}, - point::Point, -}; use super::info_line::InfoLine; use crate::{glue::convert_style, rect_ext::RectExt}; diff --git a/ferrite-tui/src/widgets/search_widget.rs b/ferrite-tui/src/widgets/search_widget.rs index 909fa72..6e33ce7 100644 --- a/ferrite-tui/src/widgets/search_widget.rs +++ b/ferrite-tui/src/widgets/search_widget.rs @@ -4,6 +4,7 @@ use ferrite_core::{ search_buffer::{Matchable, SearchBuffer}, theme::EditorTheme, }; +use ferrite_utility::graphemes::RopeGraphemeExt; use ropey::RopeSlice; use tui::{ layout::{Margin, Rect}, @@ -11,7 +12,6 @@ use tui::{ widgets::{Block, BorderType, Borders, StatefulWidget, Widget}, }; use unicode_width::UnicodeWidthStr; -use utility::graphemes::RopeGraphemeExt; use super::one_line_input_widget::OneLineInputWidget; use crate::glue::convert_style; diff --git a/utility/Cargo.toml b/ferrite-utility/Cargo.toml similarity index 92% rename from utility/Cargo.toml rename to ferrite-utility/Cargo.toml index 56bb808..d2dff09 100644 --- a/utility/Cargo.toml +++ b/ferrite-utility/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "utility" +name = "ferrite-utility" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/utility/src/chars.rs b/ferrite-utility/src/chars.rs similarity index 100% rename from utility/src/chars.rs rename to ferrite-utility/src/chars.rs diff --git a/utility/src/graphemes.rs b/ferrite-utility/src/graphemes.rs similarity index 100% rename from utility/src/graphemes.rs rename to ferrite-utility/src/graphemes.rs diff --git a/utility/src/lib.rs b/ferrite-utility/src/lib.rs similarity index 100% rename from utility/src/lib.rs rename to ferrite-utility/src/lib.rs diff --git a/utility/src/line_ending.rs b/ferrite-utility/src/line_ending.rs similarity index 100% rename from utility/src/line_ending.rs rename to ferrite-utility/src/line_ending.rs diff --git a/utility/src/point.rs b/ferrite-utility/src/point.rs similarity index 100% rename from utility/src/point.rs rename to ferrite-utility/src/point.rs