style: apply nightly rustfmt import grouping across the workspace

rustfmt.toml sets group_imports, imports_granularity and imports_layout,
which are nightly-only; agents formatted with stable rustfmt, which
ignored them. This is a formatting-only pass with `cargo +nightly fmt`.

Test Plan:
- cargo clippy --workspace --all-targets -- -D warnings
- cargo test --workspace
This commit is contained in:
ddidderr committed 2026-10-12 05:03:37 +02:00
1 parent 81d4119d85
commit 8bcb85a29a
259 files changed
+2495 -1547

No files matched your search

+27 -15
View File
@@ -11,26 +11,38 @@
//! app keeps weak references to them (the runtime owns the strong
//! `Rc<dyn CoreSurface>`).
use std::cell::{Cell, RefCell};
use std::rc::{Rc, Weak};
use std::sync::Arc;
use std::time::Instant;
use std::{
cell::{Cell, RefCell},
rc::{Rc, Weak},
sync::Arc,
time::Instant,
};
use crossbeam_channel::{Receiver, Sender, TrySendError};
use ghostty_apprt::action::{Action as RtAction, QuitTimer, ReloadConfig, Target};
use ghostty_apprt::runtime_api::{
AppMessage, CellSize as RtCellSize, CoreApp, CoreError, CoreSurface, DesiredFontSize, RtApp,
RtSurface, SurfaceId, Waker,
use ghostty_apprt::{
action::{Action as RtAction, QuitTimer, ReloadConfig, Target},
runtime_api::{
AppMessage,
CellSize as RtCellSize,
CoreApp,
CoreError,
CoreSurface,
DesiredFontSize,
RtApp,
RtSurface,
SurfaceId,
Waker,
},
structs::ColorScheme,
surface::{AppMailbox, Message as SurfaceMessage},
};
use ghostty_apprt::structs::ColorScheme;
use ghostty_apprt::surface::{AppMailbox, Message as SurfaceMessage};
use ghostty_config::conditional;
use ghostty_config::config::Config;
use ghostty_config::{conditional, config::Config};
use ghostty_datastruct::blocking_queue::Timeout;
use ghostty_font::SharedGridSet;
use ghostty_input::KeyEvent;
use ghostty_input::binding::set::Value as BindingValue;
use ghostty_input::binding::{Action as BindingAction, Scope};
use ghostty_input::{
KeyEvent,
binding::{Action as BindingAction, Scope, set::Value as BindingValue},
};
use crate::surface::Surface;
+2 -4
View File
@@ -5,11 +5,9 @@
//! the root binary before this is initialized, so what remains is: logging,
//! signal setup, rlimits and the resources directory.
use std::io::Write as _;
use std::sync::OnceLock;
use std::{io::Write as _, sync::OnceLock};
use ghostty_os::file::Rlimit;
use ghostty_os::resourcesdir::ResourcesDir;
use ghostty_os::{file::Rlimit, resourcesdir::ResourcesDir};
/// Where logging should go (Zig: `GlobalState.Logging`, a packed struct
/// parsed from `GHOSTTY_LOG`).
+66 -29
View File
@@ -2,42 +2,78 @@
//! `Search`, `searchCallback`, `dumpText`, `performBindingAction`,
//! `closingAction`, `writeScreenFile`).
use std::io::Write as _;
use std::sync::Arc;
use std::thread::JoinHandle;
use std::{io::Write as _, sync::Arc, thread::JoinHandle};
use ghostty_apprt::action::{
Action as RtAction, CloseTabMode as RtCloseTabMode, FloatWindow, Fullscreen,
GotoSplit as RtGotoSplit, GotoTab, GotoWindow as RtGotoWindow, Inspector as RtInspector,
KeyTable, MoveTab, OpenUrl, OpenUrlKind, PromptTitle, Readonly, ReloadConfig,
ResizeSplit as RtResizeSplit, ResizeSplitDirection, SecureInput, SetTitle,
SplitDirection as RtSplit, StartSearch, Target,
use ghostty_apprt::{
action::{
Action as RtAction,
CloseTabMode as RtCloseTabMode,
FloatWindow,
Fullscreen,
GotoSplit as RtGotoSplit,
GotoTab,
GotoWindow as RtGotoWindow,
Inspector as RtInspector,
KeyTable,
MoveTab,
OpenUrl,
OpenUrlKind,
PromptTitle,
Readonly,
ReloadConfig,
ResizeSplit as RtResizeSplit,
ResizeSplitDirection,
SecureInput,
SetTitle,
SplitDirection as RtSplit,
StartSearch,
Target,
},
runtime_api::{CoreError, RtApp, SurfaceId},
structs::{Clipboard, ClipboardRequest},
surface::Message as SurfaceMessage,
};
use ghostty_apprt::runtime_api::{CoreError, RtApp, SurfaceId};
use ghostty_apprt::structs::{Clipboard, ClipboardRequest};
use ghostty_apprt::surface::Message as SurfaceMessage;
use ghostty_config::types_a::NonNativeFullscreen;
use ghostty_datastruct::blocking_queue::Timeout;
use ghostty_input::binding::{
Action, AdjustSelection, CloseTabMode, CrashThread, InspectorMode, NavigateSearch, Scope,
SplitDirection, SplitFocusDirection, SplitResizeDirection, WriteScreen, WriteScreenAction,
Action,
AdjustSelection,
CloseTabMode,
CrashThread,
InspectorMode,
NavigateSearch,
Scope,
SplitDirection,
SplitFocusDirection,
SplitResizeDirection,
WriteScreen,
WriteScreenAction,
WriteScreenFormat,
};
use ghostty_renderer::message::Message as RendererMessage;
use ghostty_renderer::state::SharedState;
use ghostty_renderer::thread::Handle as RendererHandle;
use ghostty_terminal::formatter::{self, Content, Format, ScreenFormatter};
use ghostty_terminal::point::Tag;
use ghostty_terminal::screen::Scroll;
use ghostty_terminal::search::screen::Select;
use ghostty_terminal::search::thread::{
Event, Message as SearchMessage, Options as SearchOptions, TerminalLock, TerminalRef,
Thread as SearchThread,
use ghostty_renderer::{
message::Message as RendererMessage,
state::SharedState,
thread::Handle as RendererHandle,
};
use ghostty_terminal::selection::{Adjustment, Order, Selection};
use ghostty_terminal::terminal::{ScrollViewport, Terminal};
use ghostty_termio::message::Message as IoMessage;
use ghostty_termio::{SharedStateExt, TerminalGuard};
use ghostty_terminal::{
formatter::{self, Content, Format, ScreenFormatter},
point::Tag,
screen::Scroll,
search::{
screen::Select,
thread::{
Event,
Message as SearchMessage,
Options as SearchOptions,
TerminalLock,
TerminalRef,
Thread as SearchThread,
},
},
selection::{Adjustment, Order, Selection},
terminal::{ScrollViewport, Terminal},
};
use ghostty_termio::{SharedStateExt, TerminalGuard, message::Message as IoMessage};
use super::Surface;
use crate::app::Mailbox as AppMailbox;
@@ -1172,9 +1208,10 @@ impl Surface {
#[cfg(test)]
mod tests {
use super::*;
use ghostty_terminal::terminal::Options;
use super::*;
fn term(cols: u16, rows: u16) -> Terminal {
Terminal::new(Options::new(cols, rows)).unwrap()
}
+19 -16
View File
@@ -2,27 +2,30 @@
//! `copySelectionToClipboards`, clipboard requests, paste, OSC 52 and
//! desktop notifications).
use std::hash::{Hash, Hasher};
use std::rc::Rc;
use std::sync::Arc;
use std::time::{Duration, Instant};
use std::{
hash::{Hash, Hasher},
rc::Rc,
sync::Arc,
time::{Duration, Instant},
};
use base64::Engine as _;
use base64::engine::general_purpose::STANDARD;
use ghostty_apprt::action::{Action as RtAction, DesktopNotification};
use ghostty_apprt::runtime_api::ClipboardError;
use ghostty_apprt::structs::{Clipboard, ClipboardRequest};
use base64::{Engine as _, engine::general_purpose::STANDARD};
use ghostty_apprt::{
action::{Action as RtAction, DesktopNotification},
runtime_api::ClipboardError,
structs::{Clipboard, ClipboardRequest},
};
use ghostty_config::types_b::ClipboardAccess;
use ghostty_input::binding::CopyToClipboard;
use ghostty_input::paste;
use ghostty_terminal::formatter::{self, Format, ScreenFormatter};
use ghostty_terminal::selection::Selection;
use ghostty_terminal::terminal::Terminal;
use ghostty_input::{binding::CopyToClipboard, paste};
use ghostty_terminal::{
formatter::{self, Format, ScreenFormatter},
selection::Selection,
terminal::Terminal,
};
use ghostty_termio::message::Message as IoMessage;
use ghostty_vt::modes::Mode;
use super::Surface;
use super::config::DerivedConfig;
use super::{Surface, config::DerivedConfig};
/// `input.paste.Options.fromTerminal`.
#[must_use]
+2 -4
View File
@@ -6,14 +6,12 @@
//! it so the fields keep their Zig names (`cfg.copy_on_select`, ...). The
//! few values that are *computed* in Zig live as fields of this struct.
use std::ops::Deref;
use std::sync::Arc;
use std::{ops::Deref, sync::Arc};
use ghostty_config::config::Config;
use ghostty_input::link::{Action as LinkAction, Highlight};
use onig::Regex;
use ghostty_renderer::size::Padding;
use onig::Regex;
/// A link with its compiled regex (Zig: `DerivedConfig.Link`).
pub struct Link {
+2 -5
View File
@@ -5,11 +5,8 @@
use std::sync::Arc;
use ghostty_apprt::runtime_api::CoreError;
use ghostty_inspector::Shared as Inspector;
use ghostty_inspector::imgui::Ui;
use ghostty_inspector::widgets::surface::SurfaceInfo;
use ghostty_renderer::message::Message as RendererMessage;
use ghostty_renderer::state::InspectorHook;
use ghostty_inspector::{Shared as Inspector, imgui::Ui, widgets::surface::SurfaceInfo};
use ghostty_renderer::{message::Message as RendererMessage, state::InspectorHook};
use ghostty_termio::message::Message as IoMessage;
use super::Surface;
+17 -13
View File
@@ -11,20 +11,24 @@
//! time. A config change drops them anyway (`update_config` calls
//! [`Surface::end_key_sequence`] and [`Surface::deactivate_all_key_tables`]).
use ghostty_apprt::action::{Action as RtAction, KeySequence, KeyTable};
use ghostty_apprt::runtime_api::{CoreError, InputEffect};
use ghostty_input::binding::set::Value;
use ghostty_input::binding::{Action as BindingAction, Flags, Scope, Set, Trigger, TriggerKey};
use ghostty_input::key_encode;
use ghostty_input::{Action as KeyAction, Key, KeyEvent, Mods};
use ghostty_apprt::{
action::{Action as RtAction, KeySequence, KeyTable},
runtime_api::{CoreError, InputEffect},
};
use ghostty_input::{
Action as KeyAction,
Key,
KeyEvent,
Mods,
binding::{Action as BindingAction, Flags, Scope, Set, Trigger, TriggerKey, set::Value},
key_encode,
};
use ghostty_inspector as inspector;
use ghostty_terminal::terminal::{MouseEvents, ScrollViewport, Terminal};
use ghostty_termio::message::Message as IoMessage;
use ghostty_vt::modes::Mode;
use ghostty_vt::mouse_shape::MouseShape;
use ghostty_vt::{modes::Mode, mouse_shape::MouseShape};
use super::Surface;
use super::config::DerivedConfig;
use super::{Surface, config::DerivedConfig};
/// The maximum number of key tables that can be active at any given time.
/// `activate_key_table` calls after this are ignored.
@@ -1017,11 +1021,11 @@ impl Surface {
#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use ghostty_config::cli_args::ConfigField;
use ghostty_config::config::Config;
use ghostty_config::{cli_args::ConfigField, config::Config};
use ghostty_terminal::terminal::Options;
use super::*;
fn cfg_with(binds: &[&str]) -> DerivedConfig {
let mut c = Config::default();
for b in binds {
+82 -48
View File
@@ -41,55 +41,90 @@ pub mod inspector;
pub mod keyboard;
pub mod mouse;
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use std::sync::Arc;
use std::thread::JoinHandle;
use std::time::{Duration as StdDuration, Instant};
use ghostty_apprt::action::{
Action as RtAction, CellSize as ActionCellSize, ColorChange, ColorKind, CommandFinished,
ConfigChange, InitialSize, MouseVisibility, Pwd, ReloadConfig, SecureInput, SetTitle,
SizeLimit, Target,
};
use ghostty_apprt::runtime_api::{
ClipboardError, CoreError, CoreSurface, DesiredFontSize, InputEffect, RtApp, RtSurface,
SurfaceId,
};
use ghostty_apprt::structs::{
ClipboardRequest, ColorScheme, ContentScale, CursorPos, ImePos, SurfaceSize,
};
use ghostty_apprt::surface::{Mailbox as SurfaceMailboxImpl, Message};
use ghostty_config::conditional;
use ghostty_config::config::Config;
use ghostty_config::types_a::ConfirmCloseSurface;
use ghostty_datastruct::blocking_queue::Timeout;
use ghostty_font::face::DesiredSize;
use ghostty_font::metrics::Metrics;
use ghostty_font::shared_grid_set::{DerivedConfig as FontDerivedConfig, Key as FontGridKey};
use ghostty_input::{Mods, MouseButton, MouseButtonState, ScrollMods};
use ghostty_renderer::generic::Host as RendererHost;
use ghostty_renderer::message::{FontGridChange, Message as RendererMessage};
use ghostty_renderer::opengl::OpenGL;
use ghostty_renderer::options::Options as RendererOptions;
use ghostty_renderer::size::{CellSize, Coordinate, Padding, ScreenSize, Size};
use ghostty_renderer::state::{Preedit, PreeditCodepoint, State as RenderStateData};
use ghostty_renderer::thread::{Handle as RendererHandle, Running as RendererRunning};
use ghostty_renderer::{Health, Renderer};
use ghostty_terminal::page_list::Scrollbar;
use ghostty_terminal::point::Coordinate as PointCoordinate;
use ghostty_terminal::selection::Selection;
use ghostty_termio::exec;
use ghostty_termio::message::Message as IoMessage;
use ghostty_termio::{
Backend, DerivedConfig as IoDerivedConfig, Exec, Mailbox as IoMailbox, Options as IoOptions,
RendererMailbox, SharedState, SharedStateExt, TerminalGuard, Termio, Thread as IoThread,
Wakeup,
use std::{
cell::{Cell, RefCell},
rc::Rc,
sync::Arc,
thread::JoinHandle,
time::{Duration as StdDuration, Instant},
};
use crate::app::{AppState, Mailbox, Message as AppMessage};
use crate::global;
use config::DerivedConfig;
use ghostty_apprt::{
action::{
Action as RtAction,
CellSize as ActionCellSize,
ColorChange,
ColorKind,
CommandFinished,
ConfigChange,
InitialSize,
MouseVisibility,
Pwd,
ReloadConfig,
SecureInput,
SetTitle,
SizeLimit,
Target,
},
runtime_api::{
ClipboardError,
CoreError,
CoreSurface,
DesiredFontSize,
InputEffect,
RtApp,
RtSurface,
SurfaceId,
},
structs::{ClipboardRequest, ColorScheme, ContentScale, CursorPos, ImePos, SurfaceSize},
surface::{Mailbox as SurfaceMailboxImpl, Message},
};
use ghostty_config::{conditional, config::Config, types_a::ConfirmCloseSurface};
use ghostty_datastruct::blocking_queue::Timeout;
use ghostty_font::{
face::DesiredSize,
metrics::Metrics,
shared_grid_set::{DerivedConfig as FontDerivedConfig, Key as FontGridKey},
};
use ghostty_input::{Mods, MouseButton, MouseButtonState, ScrollMods};
use ghostty_renderer::{
Health,
Renderer,
generic::Host as RendererHost,
message::{FontGridChange, Message as RendererMessage},
opengl::OpenGL,
options::Options as RendererOptions,
size::{CellSize, Coordinate, Padding, ScreenSize, Size},
state::{Preedit, PreeditCodepoint, State as RenderStateData},
thread::{Handle as RendererHandle, Running as RendererRunning},
};
use ghostty_terminal::{
page_list::Scrollbar,
point::Coordinate as PointCoordinate,
selection::Selection,
};
use ghostty_termio::{
Backend,
DerivedConfig as IoDerivedConfig,
Exec,
Mailbox as IoMailbox,
Options as IoOptions,
RendererMailbox,
SharedState,
SharedStateExt,
TerminalGuard,
Termio,
Thread as IoThread,
Wakeup,
exec,
message::Message as IoMessage,
};
use crate::{
app::{AppState, Mailbox, Message as AppMessage},
global,
};
/// Minimum window size in cells (Zig: `min_window_width_cells`).
pub const MIN_WINDOW_WIDTH_CELLS: u32 = ghostty_apprt::runtime_api::MIN_WINDOW_WIDTH_CELLS;
@@ -793,8 +828,7 @@ impl Surface {
Message::ColorChange(change) => {
// Notify our apprt, but don't send a mode 2031 DSR report
// because VT sequences were used to change the color.
use ghostty_vt::color::Dynamic as D;
use ghostty_vt::osc::color::Target;
use ghostty_vt::{color::Dynamic as D, osc::color::Target};
let kind = match change.target {
Target::Palette(v) => ColorKind::Palette(i32::from(v)),
Target::Dynamic(dyn_) => match dyn_ {
+35 -18
View File
@@ -8,24 +8,40 @@
use std::time::Instant;
use ghostty_apprt::action::{Action as RtAction, MouseOverLink, OpenUrl, OpenUrlKind};
use ghostty_apprt::runtime_api::CoreError;
use ghostty_apprt::structs::{Clipboard, ClipboardRequest, CursorPos};
use ghostty_config::types_a::LinkPreviews;
use ghostty_config::types_b::{
CopyOnSelect, MouseShiftCapture as ConfigShiftCapture, RightClickAction,
use ghostty_apprt::{
action::{Action as RtAction, MouseOverLink, OpenUrl, OpenUrlKind},
runtime_api::CoreError,
structs::{Clipboard, ClipboardRequest, CursorPos},
};
use ghostty_input::link::{Action as LinkAction, Highlight};
use ghostty_input::{Mods, MouseButton, MouseButtonState, MousePressureStage, ScrollMods};
use ghostty_renderer::size::{Coordinate as SizeCoordinate, CoordinateTag, Size, SurfaceCoord};
use ghostty_renderer::state::State as RenderStateData;
use ghostty_terminal::page_list::{Direction, PageList, Pin, TrackedPin};
use ghostty_terminal::point::{Coordinate as PointCoordinate, Point};
use ghostty_terminal::screen::{Screen, SelectLine, SelectionString, SemanticClick};
use ghostty_terminal::screen_set::Key as ScreenKey;
use ghostty_terminal::selection::Selection;
use ghostty_terminal::terminal::{
MouseEvents, MouseFormat, MouseShiftCapture as TerminalShiftCapture, ScrollViewport, Terminal,
use ghostty_config::{
types_a::LinkPreviews,
types_b::{CopyOnSelect, MouseShiftCapture as ConfigShiftCapture, RightClickAction},
};
use ghostty_input::{
Mods,
MouseButton,
MouseButtonState,
MousePressureStage,
ScrollMods,
link::{Action as LinkAction, Highlight},
};
use ghostty_renderer::{
size::{Coordinate as SizeCoordinate, CoordinateTag, Size, SurfaceCoord},
state::State as RenderStateData,
};
use ghostty_terminal::{
page_list::{Direction, PageList, Pin, TrackedPin},
point::{Coordinate as PointCoordinate, Point},
screen::{Screen, SelectLine, SelectionString, SemanticClick},
screen_set::Key as ScreenKey,
selection::Selection,
terminal::{
MouseEvents,
MouseFormat,
MouseShiftCapture as TerminalShiftCapture,
ScrollViewport,
Terminal,
},
};
use ghostty_termio::message::Message as IoMessage;
use ghostty_vt::modes::Mode;
@@ -2239,10 +2255,11 @@ impl Drop for RenderOnDrop<'_> {
#[cfg(test)]
mod tests {
use super::*;
use ghostty_renderer::size::{CellSize, Padding, ScreenSize};
use ghostty_terminal::screen::Options as ScreenOptions;
use super::*;
/// Our screen size is 10x5 cells that are 10x20 px, with 5px padding on
/// all sides.
fn test_size() -> Size {