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:
1 parent
81d4119d85
commit
8bcb85a29a
259 files changed
+2495
-1547
No files matched your search
@@ -8,6 +8,14 @@
|
||||
//! into a small scratch buffer and measures it.
|
||||
#![allow(clippy::too_many_arguments)]
|
||||
|
||||
use std::io::{self, Write};
|
||||
|
||||
use ghostty_vt::{
|
||||
charsets::{Charset, Slots},
|
||||
color::{Palette, Rgb},
|
||||
modes::ENTRIES,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
highlight::pin_page_iterator,
|
||||
hyperlink::HyperlinkId,
|
||||
@@ -20,12 +28,6 @@ use crate::{
|
||||
style::{Color, Style},
|
||||
terminal::Terminal,
|
||||
};
|
||||
use ghostty_vt::{
|
||||
charsets::{Charset, Slots},
|
||||
color::{Palette, Rgb},
|
||||
modes::ENTRIES,
|
||||
};
|
||||
use std::io::{self, Write};
|
||||
|
||||
type Result<T> = io::Result<T>;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::*;
|
||||
use ghostty_vt::modes::Mode;
|
||||
|
||||
use super::*;
|
||||
|
||||
/// Format the screen with the given extras, returning output and pin map.
|
||||
fn screen_vt(t: &Terminal, mutate: impl FnOnce(&mut ScreenFormatter<'_>)) -> (String, Vec<Pin>) {
|
||||
let mut pin_map: Vec<Pin> = Vec::new();
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
|
||||
use ghostty_vt::kitty::graphics_command::{Command, Control, Display, Quiet, Response};
|
||||
|
||||
use super::graphics_image::{Error as ImageError, LoadingImage};
|
||||
use super::graphics_storage::{
|
||||
Error as StorageError, ImageStorage, Location, Placement, TerminalInfo,
|
||||
use super::{
|
||||
graphics_image::{Error as ImageError, LoadingImage},
|
||||
graphics_storage::{Error as StorageError, ImageStorage, Location, Placement, TerminalInfo},
|
||||
};
|
||||
use crate::page_list::{PageList, Pin};
|
||||
|
||||
@@ -466,9 +466,10 @@ fn encode_error(r: &mut Response, err: ImageError) {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ghostty_vt::kitty::graphics_command::{Parser, TransmissionFormat};
|
||||
|
||||
use super::*;
|
||||
use crate::terminal::{Options, Terminal};
|
||||
use ghostty_vt::kitty::graphics_command::{Parser, TransmissionFormat};
|
||||
|
||||
fn run(h: &mut Terminal, s: &str) -> Option<Response> {
|
||||
let cmd = Parser::parse_string(s.as_bytes()).unwrap();
|
||||
|
||||
@@ -3,14 +3,20 @@
|
||||
//! [`LoadingImage`] is an image that is still being transmitted (possibly in
|
||||
//! chunks). [`Image`] is a fully loaded and validated image.
|
||||
|
||||
use std::io::{Cursor, Read, Seek, SeekFrom};
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::os::unix::fs::FileExt;
|
||||
use std::path::Path;
|
||||
use std::time::Instant;
|
||||
use std::{
|
||||
io::{Cursor, Read, Seek, SeekFrom},
|
||||
os::unix::{ffi::OsStrExt, fs::FileExt},
|
||||
path::Path,
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
use ghostty_vt::kitty::graphics_command::{
|
||||
Command, Display, Quiet, TransmissionCompression, TransmissionFormat, TransmissionMedium,
|
||||
Command,
|
||||
Display,
|
||||
Quiet,
|
||||
TransmissionCompression,
|
||||
TransmissionFormat,
|
||||
TransmissionMedium,
|
||||
};
|
||||
|
||||
use crate::page_list::Pin;
|
||||
@@ -138,8 +144,7 @@ impl LoadingImage {
|
||||
|
||||
/// Reads the data from a shared memory segment.
|
||||
fn read_shared_memory(&mut self, offset: u32, size: u32, path: &[u8]) -> Result<(), Error> {
|
||||
use rustix::fs::Mode;
|
||||
use rustix::shm;
|
||||
use rustix::{fs::Mode, shm};
|
||||
|
||||
let path_str = String::from_utf8_lossy(path);
|
||||
let fd = match shm::open(path, shm::OFlags::RDONLY, Mode::empty()) {
|
||||
@@ -565,9 +570,10 @@ pub struct Rect {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ghostty_vt::kitty::graphics_command::{Control, Transmission};
|
||||
|
||||
use super::*;
|
||||
|
||||
const RGB_NONE_20X15: &[u8] =
|
||||
include_bytes!("testdata/image-rgb-none-20x15-2147483647-raw.data");
|
||||
const RGB_ZLIB_128X96: &[u8] =
|
||||
@@ -894,10 +900,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn image_load_shared_memory() {
|
||||
use rustix::fs::Mode;
|
||||
use rustix::shm;
|
||||
use std::io::Write;
|
||||
|
||||
use rustix::{fs::Mode, shm};
|
||||
|
||||
let name = format!("/ghostty-kitty-test-{}", std::process::id());
|
||||
let fd = shm::open(
|
||||
name.as_str(),
|
||||
|
||||
@@ -21,9 +21,11 @@ use std::collections::{BTreeMap, HashMap};
|
||||
use ghostty_vt::kitty::graphics_command::Delete;
|
||||
|
||||
use super::graphics_image::{Image, LoadingImage, Rect};
|
||||
use crate::page_list::{Overflow, PageList, TrackedPin};
|
||||
use crate::point::{Coordinate, Point};
|
||||
use crate::size::CellCountInt;
|
||||
use crate::{
|
||||
page_list::{Overflow, PageList, TrackedPin},
|
||||
point::{Coordinate, Point},
|
||||
size::CellCountInt,
|
||||
};
|
||||
|
||||
/// The subset of terminal state that the storage needs to read.
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
|
||||
|
||||
@@ -2,14 +2,18 @@
|
||||
//! Kitty graphics protocol unicode placeholder, virtual placement feature
|
||||
//! (`ZIG/src/terminal/kitty/graphics_unicode.zig`).
|
||||
|
||||
use super::graphics_image::Image;
|
||||
use super::graphics_render::Placement as RenderPlacement;
|
||||
use super::graphics_storage::{ImageStorage, Location, PlacementKey};
|
||||
use crate::page::Cell;
|
||||
use crate::page_list::{CellSubset, Direction, PageList, Pin, RowIterator};
|
||||
use crate::point::Tag;
|
||||
use crate::size::CellCountInt;
|
||||
use crate::style::Color;
|
||||
use super::{
|
||||
graphics_image::Image,
|
||||
graphics_render::Placement as RenderPlacement,
|
||||
graphics_storage::{ImageStorage, Location, PlacementKey},
|
||||
};
|
||||
use crate::{
|
||||
page::Cell,
|
||||
page_list::{CellSubset, Direction, PageList, Pin, RowIterator},
|
||||
point::Tag,
|
||||
size::CellCountInt,
|
||||
style::Color,
|
||||
};
|
||||
|
||||
/// Codepoint for the unicode placeholder character.
|
||||
pub const PLACEHOLDER: u32 = 0x10EEEE;
|
||||
@@ -638,11 +642,13 @@ const DIACRITICS: &[u32] = &[
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ghostty_vt::{modes::Mode, sgr::Attribute};
|
||||
|
||||
use super::*;
|
||||
use crate::kitty::graphics_storage::Placement as StoragePlacement;
|
||||
use crate::terminal::{Options, Terminal};
|
||||
use ghostty_vt::modes::Mode;
|
||||
use ghostty_vt::sgr::Attribute;
|
||||
use crate::{
|
||||
kitty::graphics_storage::Placement as StoragePlacement,
|
||||
terminal::{Options, Terminal},
|
||||
};
|
||||
|
||||
fn term(cols: u16, rows: u16) -> Terminal {
|
||||
let mut t = Terminal::new(Options::new(cols, rows)).unwrap();
|
||||
|
||||
@@ -17,7 +17,6 @@ pub mod graphics_storage;
|
||||
pub mod graphics_unicode;
|
||||
|
||||
pub use ghostty_vt::kitty::{color, graphics_command, key};
|
||||
|
||||
pub use graphics_command::{Command, Parser as CommandParser, Response};
|
||||
pub use graphics_exec::{ExecTerminal, execute};
|
||||
pub use graphics_image::Image;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
//! Compact cells and rows, with bounded owned page storage.
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use ghostty_vt::color::Rgb;
|
||||
|
||||
use crate::{
|
||||
hyperlink::{self, Hyperlink, HyperlinkId},
|
||||
ref_counted_set::{AddError, Layout as SetLayout},
|
||||
style::{self, Style},
|
||||
};
|
||||
use ghostty_vt::color::Rgb;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
/// Default grapheme allocation request, in bytes.
|
||||
pub const GRAPHEME_BYTES_DEFAULT: u32 = 1024;
|
||||
/// Default string allocation request, in bytes.
|
||||
|
||||
@@ -1,15 +1,25 @@
|
||||
//! Linked terminal pages, byte-bounded history, and stable tracked coordinates.
|
||||
use crate::{
|
||||
page::{
|
||||
self, Adjustment, Capacity, Cell, ContentTag, Error, Page, Row, SemanticContent,
|
||||
SemanticPrompt, Wide,
|
||||
},
|
||||
point::{Coordinate, Point, Tag},
|
||||
};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::atomic::{AtomicUsize, Ordering},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
page::{
|
||||
self,
|
||||
Adjustment,
|
||||
Capacity,
|
||||
Cell,
|
||||
ContentTag,
|
||||
Error,
|
||||
Page,
|
||||
Row,
|
||||
SemanticContent,
|
||||
SemanticPrompt,
|
||||
Wide,
|
||||
},
|
||||
point::{Coordinate, Point, Tag},
|
||||
};
|
||||
/// Slab index and generation; stale references never alias a reused node.
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub struct NodeId {
|
||||
@@ -7214,8 +7224,9 @@ mod tests {
|
||||
}
|
||||
#[test]
|
||||
fn page_list_resize_reflow_exceeds_style_memory_forcing_capacity_increase() {
|
||||
use crate::style::{Color, Style};
|
||||
use ghostty_vt::color::Rgb;
|
||||
|
||||
use crate::style::{Color, Style};
|
||||
let mut s = two_page_fixture(page::STD_CAPACITY.styles - 1, 1, Some(0));
|
||||
assert_ne!(s.first, s.last);
|
||||
assert_eq!(s.node(s.first.unwrap()).unwrap().next, s.last);
|
||||
|
||||
@@ -34,6 +34,13 @@
|
||||
//! waste, it is recommended that the caller drop and start with an
|
||||
//! empty render state every so often.
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use ghostty_vt::{
|
||||
color::{self, Palette, Rgb},
|
||||
modes::Mode,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
cursor,
|
||||
highlight::Flattened,
|
||||
@@ -46,11 +53,6 @@ use crate::{
|
||||
style::{Color, Style},
|
||||
terminal::{Dirty as TerminalDirty, Terminal},
|
||||
};
|
||||
use ghostty_vt::{
|
||||
color::{self, Palette, Rgb},
|
||||
modes::Mode,
|
||||
};
|
||||
use std::collections::HashSet;
|
||||
|
||||
/// Contains the state required to render the screen. See the module docs.
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
@@ -18,21 +18,6 @@
|
||||
clippy::doc_overindented_list_items,
|
||||
clippy::items_after_statements
|
||||
)]
|
||||
use crate::{
|
||||
cursor::Style as CursorStyle,
|
||||
formatter::{Content as FormatContent, Options as FormatOptions, ScreenFormatter},
|
||||
hyperlink::{self, Hyperlink, HyperlinkId},
|
||||
kitty::graphics_storage::ImageStorage,
|
||||
page::{Cell, ContentTag, Page, Row, SemanticContent, SemanticPrompt as RowPrompt, Wide},
|
||||
page_list::{
|
||||
CellSubset, Chunk, Direction, IncreaseCapacity, NodeId, PageList, Pin,
|
||||
Scroll as ListScroll, TrackedPin, Viewport,
|
||||
},
|
||||
point::{Coordinate, Point, Tag},
|
||||
selection::{Bounds, Order, Selection},
|
||||
size,
|
||||
style::{self, Style},
|
||||
};
|
||||
use ghostty_vt::{
|
||||
ansi::ProtectedMode,
|
||||
charsets::{Charset, Slots},
|
||||
@@ -41,11 +26,33 @@ use ghostty_vt::{
|
||||
sgr,
|
||||
};
|
||||
|
||||
pub use crate::page::Error;
|
||||
|
||||
/// The Unicode codepoint used by the Kitty graphics protocol for virtual
|
||||
/// placements (`kitty.graphics.unicode.placeholder`).
|
||||
use crate::kitty::graphics_unicode::PLACEHOLDER as KITTY_PLACEHOLDER;
|
||||
pub use crate::page::Error;
|
||||
use crate::{
|
||||
cursor::Style as CursorStyle,
|
||||
formatter::{Content as FormatContent, Options as FormatOptions, ScreenFormatter},
|
||||
hyperlink::{self, Hyperlink, HyperlinkId},
|
||||
kitty::graphics_storage::ImageStorage,
|
||||
page::{Cell, ContentTag, Page, Row, SemanticContent, SemanticPrompt as RowPrompt, Wide},
|
||||
page_list::{
|
||||
CellSubset,
|
||||
Chunk,
|
||||
Direction,
|
||||
IncreaseCapacity,
|
||||
NodeId,
|
||||
PageList,
|
||||
Pin,
|
||||
Scroll as ListScroll,
|
||||
TrackedPin,
|
||||
Viewport,
|
||||
},
|
||||
point::{Coordinate, Point, Tag},
|
||||
selection::{Bounds, Order, Selection},
|
||||
size,
|
||||
style::{self, Style},
|
||||
};
|
||||
|
||||
/// See Terminal.Dirty. This behaves the same way.
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::*;
|
||||
use ghostty_vt::sgr::Attribute as A;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn screen_read_and_write() {
|
||||
let mut s = init(80, 24, 1000);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use super::*;
|
||||
use ghostty_vt::{color::Rgb, sgr::Attribute as A};
|
||||
|
||||
use super::*;
|
||||
|
||||
fn bg155() -> A<'static> {
|
||||
A::DirectColorBg(Rgb { r: 155, g: 0, b: 0 })
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use super::*;
|
||||
use crate::page::Wide;
|
||||
use crate::screen::{PromptKind, SemanticContentSet};
|
||||
use crate::{
|
||||
page::Wide,
|
||||
screen::{PromptKind, SemanticContentSet},
|
||||
};
|
||||
|
||||
fn cell_at(s: &Screen, pt: Point) -> Cell {
|
||||
s.pages.get_cell(pt).unwrap()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use ghostty_vt::{color::Rgb, sgr::Attribute as A};
|
||||
|
||||
use super::*;
|
||||
use crate::page::STD_CAPACITY;
|
||||
use crate::style::Color;
|
||||
use ghostty_vt::color::Rgb;
|
||||
use ghostty_vt::sgr::Attribute as A;
|
||||
use crate::{page::STD_CAPACITY, style::Color};
|
||||
|
||||
fn sel_str(s: &Screen, sel: Selection, trim: bool) -> String {
|
||||
s.selection_string(SelectionString { sel, trim })
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
//! and handling the active area moving as new lines are added to the bottom.
|
||||
|
||||
use super::sliding_window::{Direction, SlidingWindow};
|
||||
use crate::highlight::Flattened;
|
||||
use crate::page_list::{NodeId, PageList};
|
||||
use crate::{
|
||||
highlight::Flattened,
|
||||
page_list::{NodeId, PageList},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ActiveSearch {
|
||||
@@ -103,8 +105,7 @@ impl ActiveSearch {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::test_util::*;
|
||||
use super::*;
|
||||
use super::{super::test_util::*, *};
|
||||
use crate::point::Tag;
|
||||
|
||||
fn check(list: &PageList, h: &Flattened, s: (u16, u32), e: (u16, u32)) {
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
//! list takes it as a parameter.
|
||||
|
||||
use super::sliding_window::{Direction, SlidingWindow};
|
||||
use crate::highlight::Flattened;
|
||||
use crate::page::Error;
|
||||
use crate::page_list::{NodeId, PageList, Pin, TrackedPin};
|
||||
use crate::{
|
||||
highlight::Flattened,
|
||||
page::Error,
|
||||
page_list::{NodeId, PageList, Pin, TrackedPin},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PageListSearch {
|
||||
@@ -144,11 +146,8 @@ impl PageListSearch {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::test_util::*;
|
||||
use super::*;
|
||||
use crate::point::Tag;
|
||||
use crate::screen::SelectionString;
|
||||
use crate::selection::Selection;
|
||||
use super::{super::test_util::*, *};
|
||||
use crate::{point::Tag, screen::SelectionString, selection::Selection};
|
||||
|
||||
fn check(list: &PageList, h: &Flattened, s: (u16, u32), e: (u16, u32)) {
|
||||
let sel = h.untracked();
|
||||
|
||||
@@ -17,14 +17,18 @@
|
||||
//! that touches it (`new`, `deinit`, `feed`, `reload_active`, `select`,
|
||||
//! `search_all`); `tick`, `matches`, `selected_match` etc. do not need it.
|
||||
|
||||
use super::active::ActiveSearch;
|
||||
use super::pagelist::PageListSearch;
|
||||
use super::sliding_window::{Direction, SlidingWindow};
|
||||
use crate::highlight::{Flattened, Tracked};
|
||||
use crate::page::Error;
|
||||
use crate::page_list::{NodeId, PageList, Pin, TrackedPin};
|
||||
use crate::screen::Screen;
|
||||
use crate::size::CellCountInt;
|
||||
use super::{
|
||||
active::ActiveSearch,
|
||||
pagelist::PageListSearch,
|
||||
sliding_window::{Direction, SlidingWindow},
|
||||
};
|
||||
use crate::{
|
||||
highlight::{Flattened, Tracked},
|
||||
page::Error,
|
||||
page_list::{NodeId, PageList, Pin, TrackedPin},
|
||||
screen::Screen,
|
||||
size::CellCountInt,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ScreenSearch {
|
||||
@@ -856,10 +860,11 @@ impl ScreenSearch {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::test_util::*;
|
||||
use super::*;
|
||||
use crate::point::{Point, Tag};
|
||||
use crate::terminal::Terminal;
|
||||
use super::{super::test_util::*, *};
|
||||
use crate::{
|
||||
point::{Point, Tag},
|
||||
terminal::Terminal,
|
||||
};
|
||||
|
||||
fn pts(t: &Terminal, h: &Flattened, tag: Tag) -> (Option<Point>, Option<Point>) {
|
||||
let sel = h.untracked();
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use crate::formatter::{Options, PageFormatter};
|
||||
use crate::highlight::{Chunk, Flattened};
|
||||
use crate::page::Page;
|
||||
use crate::page_list::{Node, NodeId, PageList};
|
||||
use crate::point::Coordinate;
|
||||
use crate::{
|
||||
formatter::{Options, PageFormatter},
|
||||
highlight::{Chunk, Flattened},
|
||||
page::Page,
|
||||
page_list::{Node, NodeId, PageList},
|
||||
point::Coordinate,
|
||||
};
|
||||
|
||||
/// The search direction. If the direction is forward then pages should
|
||||
/// be appended in forward linked list order from the PageList. If the
|
||||
@@ -464,11 +466,12 @@ impl SlidingWindow {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::test_util::*;
|
||||
use super::*;
|
||||
use crate::highlight::Flattened;
|
||||
use crate::point::{Point, Tag};
|
||||
use crate::screen::Screen;
|
||||
use super::{super::test_util::*, *};
|
||||
use crate::{
|
||||
highlight::Flattened,
|
||||
point::{Point, Tag},
|
||||
screen::Screen,
|
||||
};
|
||||
|
||||
fn check(list: &PageList, h: &Flattened, tag: Tag, s: (u16, u32), e: (u16, u32)) {
|
||||
let sel = h.untracked();
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
//! Shared helpers for search tests.
|
||||
|
||||
use crate::page_list::{NodeId, PageList};
|
||||
use crate::point::{Coordinate, Point, Tag};
|
||||
use crate::screen::{Options, Screen};
|
||||
use crate::terminal::{self, Terminal};
|
||||
use crate::{
|
||||
page_list::{NodeId, PageList},
|
||||
point::{Coordinate, Point, Tag},
|
||||
screen::{Options, Screen},
|
||||
terminal::{self, Terminal},
|
||||
};
|
||||
|
||||
pub fn screen(cols: u16, rows: u16, max_scrollback: usize) -> Screen {
|
||||
Screen::new(Options::new(cols, rows, max_scrollback)).unwrap()
|
||||
|
||||
@@ -13,19 +13,25 @@
|
||||
//! based refresh timer. The terminal and its mutex are combined into an
|
||||
//! `Arc<Mutex<Terminal>>`.
|
||||
|
||||
use std::ops::DerefMut;
|
||||
use std::sync::{Arc, Mutex, PoisonError};
|
||||
use std::time::{Duration, Instant};
|
||||
use std::{
|
||||
ops::DerefMut,
|
||||
sync::{Arc, Mutex, PoisonError},
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use crossbeam_channel::{Receiver, Sender, TrySendError};
|
||||
|
||||
use super::screen::{ScreenSearch, Select, TickError};
|
||||
use super::viewport::ViewportSearch;
|
||||
use crate::highlight::{Flattened, Untracked};
|
||||
use crate::page_list::{Chunk, Direction as ListDirection};
|
||||
use crate::point::{Coordinate, Point};
|
||||
use crate::screen_set::Key as ScreenKey;
|
||||
use crate::terminal::Terminal;
|
||||
use super::{
|
||||
screen::{ScreenSearch, Select, TickError},
|
||||
viewport::ViewportSearch,
|
||||
};
|
||||
use crate::{
|
||||
highlight::{Flattened, Untracked},
|
||||
page_list::{Chunk, Direction as ListDirection},
|
||||
point::{Coordinate, Point},
|
||||
screen_set::Key as ScreenKey,
|
||||
terminal::Terminal,
|
||||
};
|
||||
|
||||
// TODO: Some stuff that could be improved:
|
||||
// - pause the refresh timer when the terminal isn't focused
|
||||
@@ -770,11 +776,11 @@ impl Search {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::test_util::*;
|
||||
use super::*;
|
||||
use crate::point::Tag;
|
||||
use std::sync::mpsc;
|
||||
|
||||
use super::{super::test_util::*, *};
|
||||
use crate::point::Tag;
|
||||
|
||||
#[derive(Default)]
|
||||
struct TestUserData {
|
||||
total: usize,
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
//! lives in the same page.
|
||||
|
||||
use super::sliding_window::{Direction, SlidingWindow};
|
||||
use crate::highlight::Flattened;
|
||||
use crate::page_list::{Direction as ListDirection, NodeId, PageList};
|
||||
use crate::point::{Coordinate, Point, Tag};
|
||||
use crate::{
|
||||
highlight::Flattened,
|
||||
page_list::{Direction as ListDirection, NodeId, PageList},
|
||||
point::{Coordinate, Point, Tag},
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct ViewportSearch {
|
||||
@@ -223,8 +225,7 @@ impl ViewportSearch {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::test_util::*;
|
||||
use super::*;
|
||||
use super::{super::test_util::*, *};
|
||||
use crate::terminal::ScrollViewport;
|
||||
|
||||
fn check(list: &PageList, h: &Flattened, tag: Tag, s: (u16, u32), e: (u16, u32)) {
|
||||
|
||||
@@ -12,12 +12,6 @@
|
||||
//! output and doesn't need to respond (since it maybe isn't running the
|
||||
//! actual program), this is the stream type to use. For example, this is
|
||||
//! ideal for replay tooling, CI logs, PaaS builder output, etc.
|
||||
use crate::{
|
||||
cursor::Style as CursorStyle,
|
||||
terminal::{
|
||||
DeccolmMode, Error, MouseEvents, MouseFormat, MouseShiftCapture, SwitchScreenMode, Terminal,
|
||||
},
|
||||
};
|
||||
use ghostty_vt::{
|
||||
ansi::{CursorStyle as AnsiCursorStyle, ModifyKeyFormat, ProtectedMode},
|
||||
color::Dynamic as DynamicColor,
|
||||
@@ -28,6 +22,19 @@ use ghostty_vt::{
|
||||
stream::{self, Action},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
cursor::Style as CursorStyle,
|
||||
terminal::{
|
||||
DeccolmMode,
|
||||
Error,
|
||||
MouseEvents,
|
||||
MouseFormat,
|
||||
MouseShiftCapture,
|
||||
SwitchScreenMode,
|
||||
Terminal,
|
||||
},
|
||||
};
|
||||
|
||||
/// The stream type wrapping [`Handler`].
|
||||
pub type Stream<'a> = stream::Stream<Handler<'a>>;
|
||||
|
||||
@@ -450,9 +457,10 @@ impl stream::Handler for Handler<'_> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use ghostty_vt::osc::semantic_prompt::Redraw;
|
||||
|
||||
use super::*;
|
||||
use crate::{page::SemanticContent, screen_set::Key as ScreenKey, terminal::Options};
|
||||
use ghostty_vt::osc::semantic_prompt::Redraw;
|
||||
|
||||
fn term(cols: u16, rows: u16) -> Terminal {
|
||||
Terminal::new(Options::new(cols, rows)).unwrap()
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
//!
|
||||
//! Port of `ZIG/src/terminal/StringMap.zig`. Regex matching uses Oniguruma
|
||||
//! (the `onig` crate), like Ghostty.
|
||||
use crate::{page_list::Pin, selection::Selection};
|
||||
use onig::{MatchParam, Regex, Region, SearchOptions};
|
||||
|
||||
use crate::{page_list::Pin, selection::Selection};
|
||||
|
||||
/// Retry budget for StringMap regex searches.
|
||||
///
|
||||
/// Units are Oniguruma retry steps (internal backtracking/retry counter),
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
//! Cell styles, color resolution, and VT/HTML serialization.
|
||||
use crate::page::{Cell, ContentTag};
|
||||
use ghostty_vt::{
|
||||
color::{Palette, Rgb},
|
||||
sgr::Underline,
|
||||
};
|
||||
use std::{
|
||||
fmt,
|
||||
hash::{Hash, Hasher},
|
||||
};
|
||||
|
||||
use ghostty_vt::{
|
||||
color::{Palette, Rgb},
|
||||
sgr::Underline,
|
||||
};
|
||||
|
||||
use crate::page::{Cell, ContentTag};
|
||||
/// Nonzero page-local style identifier.
|
||||
pub type Id = u16;
|
||||
/// The default style needs no set lookup.
|
||||
|
||||
@@ -18,19 +18,6 @@
|
||||
clippy::items_after_statements,
|
||||
clippy::too_many_lines
|
||||
)]
|
||||
use crate::{
|
||||
page::{Cell, ContentTag, Page, SemanticContent, SemanticPrompt as RowPrompt, Wide},
|
||||
page_list::{Direction, IncreaseCapacity, Pin},
|
||||
point::{Coordinate, Point},
|
||||
screen::{
|
||||
CharsetState, InputClear, Options as ScreenOptions, Resize as ScreenResize, SavedCursor,
|
||||
Screen, Scroll, SemanticClick, SemanticContentSet as SetSemantic,
|
||||
},
|
||||
screen_set::{Key as ScreenKey, ScreenSet},
|
||||
size,
|
||||
style::{self, Color as StyleColor, Style},
|
||||
tabstops::Tabstops,
|
||||
};
|
||||
use ghostty_vt::{
|
||||
ansi::{ProtectedMode, StatusDisplay},
|
||||
charsets::{self, Charset, Slots},
|
||||
@@ -47,6 +34,26 @@ use ghostty_vt::{
|
||||
};
|
||||
|
||||
pub use crate::page::Error;
|
||||
use crate::{
|
||||
page::{Cell, ContentTag, Page, SemanticContent, SemanticPrompt as RowPrompt, Wide},
|
||||
page_list::{Direction, IncreaseCapacity, Pin},
|
||||
point::{Coordinate, Point},
|
||||
screen::{
|
||||
CharsetState,
|
||||
InputClear,
|
||||
Options as ScreenOptions,
|
||||
Resize as ScreenResize,
|
||||
SavedCursor,
|
||||
Screen,
|
||||
Scroll,
|
||||
SemanticClick,
|
||||
SemanticContentSet as SetSemantic,
|
||||
},
|
||||
screen_set::{Key as ScreenKey, ScreenSet},
|
||||
size,
|
||||
style::{self, Color as StyleColor, Style},
|
||||
tabstops::Tabstops,
|
||||
};
|
||||
|
||||
/// Default tabstop interval
|
||||
const TABSTOP_INTERVAL: usize = 8;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use ghostty_vt::{color::Rgb, sgr::Attribute};
|
||||
|
||||
use super::*;
|
||||
use crate::page::{Cell, Wide};
|
||||
use ghostty_vt::color::Rgb;
|
||||
use ghostty_vt::sgr::Attribute;
|
||||
|
||||
fn c(t: &Terminal, x: u16, y: u32) -> Cell {
|
||||
cell_at(t, pt_screen(x, y))
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
use ghostty_vt::{color::Rgb, modes::Mode, sgr::Attribute as A};
|
||||
|
||||
use super::*;
|
||||
use crate::page::ContentTag;
|
||||
use crate::point::Tag;
|
||||
use ghostty_vt::color::Rgb;
|
||||
use ghostty_vt::modes::Mode;
|
||||
use ghostty_vt::sgr::Attribute as A;
|
||||
use crate::{page::ContentTag, point::Tag};
|
||||
|
||||
fn cr_lf(t: &mut Terminal) {
|
||||
t.carriage_return();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use ghostty_vt::{color::Rgb, sgr::Attribute as A};
|
||||
|
||||
use super::*;
|
||||
use ghostty_vt::color::Rgb;
|
||||
use ghostty_vt::sgr::Attribute as A;
|
||||
|
||||
const RED: Rgb = Rgb {
|
||||
r: 0xFF,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use ghostty_vt::{color::Rgb, sgr::Attribute};
|
||||
|
||||
use super::*;
|
||||
use crate::page::ContentTag;
|
||||
use ghostty_vt::color::Rgb;
|
||||
use ghostty_vt::sgr::Attribute;
|
||||
|
||||
fn prints(t: &mut Terminal, s: &str) {
|
||||
for c in s.chars() {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use ghostty_vt::{charsets::Slots, color::Rgb, sgr::Attribute};
|
||||
|
||||
use super::*;
|
||||
use crate::page::{ContentTag, Wide};
|
||||
use ghostty_vt::charsets::Slots;
|
||||
use ghostty_vt::color::Rgb;
|
||||
use ghostty_vt::sgr::Attribute;
|
||||
|
||||
/// Zig `for ("...") |c| try t.print(c)`.
|
||||
fn pr(t: &mut Terminal, s: &str) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use super::*;
|
||||
use crate::page::{ContentTag, SemanticContent, SemanticPrompt as RowPrompt};
|
||||
use ghostty_vt::{
|
||||
ansi::ProtectedMode,
|
||||
color::Rgb,
|
||||
@@ -8,6 +6,9 @@ use ghostty_vt::{
|
||||
sgr::{Attribute as A, Underline},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
use crate::page::{ContentTag, SemanticContent, SemanticPrompt as RowPrompt};
|
||||
|
||||
fn pr(t: &mut Terminal, s: &str) {
|
||||
for c in s.chars() {
|
||||
t.print(u32::from(c)).unwrap();
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
use ghostty_vt::{
|
||||
color::Rgb,
|
||||
osc::{
|
||||
SemanticPrompt as Cmd,
|
||||
semantic_prompt::{Action as A, Click},
|
||||
},
|
||||
sgr::Attribute,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
use crate::page::{ContentTag, SemanticContent, SemanticPrompt as RowPrompt};
|
||||
use crate::screen::SemanticClick;
|
||||
use ghostty_vt::color::Rgb;
|
||||
use ghostty_vt::osc::{
|
||||
SemanticPrompt as Cmd,
|
||||
semantic_prompt::{Action as A, Click},
|
||||
use crate::{
|
||||
page::{ContentTag, SemanticContent, SemanticPrompt as RowPrompt},
|
||||
screen::SemanticClick,
|
||||
};
|
||||
use ghostty_vt::sgr::Attribute;
|
||||
|
||||
fn sp(a: A) -> Cmd {
|
||||
Cmd::init(a)
|
||||
|
||||
@@ -4,7 +4,9 @@ pub mod layout;
|
||||
pub mod output;
|
||||
pub mod viewer;
|
||||
|
||||
pub use ghostty_vt::tmux::control;
|
||||
pub use ghostty_vt::tmux::control::{Notification as ControlNotification, Parser as ControlParser};
|
||||
pub use ghostty_vt::tmux::{
|
||||
control,
|
||||
control::{Notification as ControlNotification, Parser as ControlParser},
|
||||
};
|
||||
pub use layout::Layout;
|
||||
pub use viewer::Viewer;
|
||||
@@ -316,9 +316,10 @@ pub fn format(vars: &[Variable], delimiter: char) -> String {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use Variable::*;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn flag(v: Variable) {
|
||||
assert_eq!(v.parse("1"), Ok(Value::Bool(true)));
|
||||
assert_eq!(v.parse("0"), Ok(Value::Bool(false)));
|
||||
|
||||
@@ -62,17 +62,20 @@
|
||||
|
||||
use std::collections::VecDeque;
|
||||
|
||||
use ghostty_vt::modes::Mode;
|
||||
use ghostty_vt::tmux::control::Notification;
|
||||
use ghostty_vt::{modes::Mode, tmux::control::Notification};
|
||||
|
||||
use super::layout::{self, Content, Layout};
|
||||
use super::output::{self, Variable};
|
||||
use crate::cursor::Style as CursorStyle;
|
||||
use crate::page;
|
||||
use crate::point::{Coordinate, Point};
|
||||
use crate::screen_set::Key as ScreenKey;
|
||||
use crate::size::CellCountInt;
|
||||
use crate::terminal::{Options as TerminalOptions, Terminal};
|
||||
use super::{
|
||||
layout::{self, Content, Layout},
|
||||
output::{self, Variable},
|
||||
};
|
||||
use crate::{
|
||||
cursor::Style as CursorStyle,
|
||||
page,
|
||||
point::{Coordinate, Point},
|
||||
screen_set::Key as ScreenKey,
|
||||
size::CellCountInt,
|
||||
terminal::{Options as TerminalOptions, Terminal},
|
||||
};
|
||||
|
||||
/// The initial capacity of the command queue.
|
||||
const COMMAND_QUEUE_INITIAL: usize = 8;
|
||||
|
||||
Reference in new issue
Block a user