mirror of
https://github.com/lotabout/skim.git
synced 2026-09-10 07:16:23 -04:00
chore: format imports
This commit is contained in:
parent
42fa8e143b
commit
0de1a2acbb
|
|
@ -1,5 +1,5 @@
|
|||
set -xeuo pipefail
|
||||
|
||||
cargo fmt --check --all
|
||||
cargo +nightly fmt --check --all
|
||||
cargo clippy --all-targets -- -Dwarnings
|
||||
cargo check --no-default-features
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
max_width = 120
|
||||
max_width = 120
|
||||
imports_granularity = "Module"
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
1. Build: `RUSTFLAGS="-Zsanitizer=thread" cargo +nightly build --tests -Zbuild-std --target x86_64-unknown-linux-gnu`
|
||||
2. Run: `TSAN_OPTIONS="detect_deadlocks=1" cargo +nightly nextest run --profile tsan --target x86_64-unknown-linux-gnu`
|
||||
- Lint: `cargo clippy`
|
||||
- Format: `cargo fmt` (check only: `cargo fmt --check`)
|
||||
- Format: `cargo +nightly fmt` (check only: `cargo +nightly fmt --check`)
|
||||
|
||||
## Code Style
|
||||
- Format with 120 char line width (defined in .rustfmt.toml)
|
||||
|
|
|
|||
|
|
@ -1310,10 +1310,12 @@ where
|
|||
}
|
||||
|
||||
fn cmd_plot(args: &PlotArgs) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
use gnuplot::{
|
||||
AlignType::*, AutoOption::Fix, AxesCommon, BorderLocation2D::*, Caption, Color, Figure, FillAlpha,
|
||||
LabelOption::TextColor, LegendOption::Placement, LineWidth,
|
||||
};
|
||||
use gnuplot::AlignType::*;
|
||||
use gnuplot::AutoOption::Fix;
|
||||
use gnuplot::BorderLocation2D::*;
|
||||
use gnuplot::LabelOption::TextColor;
|
||||
use gnuplot::LegendOption::Placement;
|
||||
use gnuplot::{AxesCommon, Caption, Color, Figure, FillAlpha, LineWidth};
|
||||
|
||||
// ── Catppuccin Mocha dark palette ─────────────────────────────────────────
|
||||
// Colours are referenced as HTML hex strings throughout.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
//! Demonstrates selecting ANSI-colored command output.
|
||||
|
||||
extern crate skim;
|
||||
use skim::{prelude::*, reader::CommandCollector};
|
||||
use skim::prelude::*;
|
||||
use skim::reader::CommandCollector;
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
//! Runs skim from an async Tokio entry point.
|
||||
|
||||
use skim::{Skim, prelude::SkimOptionsBuilder};
|
||||
use skim::Skim;
|
||||
use skim::prelude::SkimOptionsBuilder;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
//! Demonstrates basic item selection with inline status information.
|
||||
|
||||
use skim::{prelude::*, tui::statusline::InfoDisplay};
|
||||
use skim::prelude::*;
|
||||
use skim::tui::statusline::InfoDisplay;
|
||||
|
||||
fn main() -> color_eyre::Result<()> {
|
||||
let opts = SkimOptionsBuilder::default()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
//! Runs skim repeatedly to check that runs clean up their worker threads.
|
||||
|
||||
use skim::{Skim, prelude::SkimOptionsBuilder};
|
||||
use skim::Skim;
|
||||
use skim::prelude::SkimOptionsBuilder;
|
||||
|
||||
// Hint: use `ps -T -p $(pgrep -f target/debug/examples/multiple_runs)` to watch threads while the
|
||||
// different invocations run, and make sure none is leaking through
|
||||
|
|
|
|||
|
|
@ -3,10 +3,8 @@
|
|||
//! This module provides utilities for parsing and managing keyboard shortcuts
|
||||
//! and their associated actions in skim.
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
ops::{Deref, DerefMut},
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
use color_eyre::Result;
|
||||
use color_eyre::eyre::eyre;
|
||||
|
|
|
|||
|
|
@ -2,14 +2,16 @@ use std::cmp::min;
|
|||
use std::fmt::{Display, Error, Formatter};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::fuzzy_matcher::FuzzyMatcher;
|
||||
use crate::fuzzy_matcher::arinae::ArinaeMatcher;
|
||||
use crate::fuzzy_matcher::clangd::ClangdMatcher;
|
||||
#[cfg(frizbee)]
|
||||
use crate::fuzzy_matcher::frizbee::FrizbeeMatcher;
|
||||
use crate::fuzzy_matcher::{FuzzyMatcher, clangd::ClangdMatcher, fzy::FzyMatcher, skim::SkimMatcherV2};
|
||||
use crate::fuzzy_matcher::fzy::FzyMatcher;
|
||||
use crate::fuzzy_matcher::skim::SkimMatcherV2;
|
||||
|
||||
use crate::item::RankBuilder;
|
||||
use crate::{CaseMatching, MatchEngine, Typos};
|
||||
use crate::{MatchRange, MatchResult, SkimItem};
|
||||
use crate::{CaseMatching, MatchEngine, MatchRange, MatchResult, SkimItem, Typos};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Fuzzy matching algorithm to use
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@
|
|||
use std::borrow::Cow;
|
||||
use std::fmt::{Display, Error, Formatter};
|
||||
|
||||
use crate::engine::util::{map_byte_range_to_original, map_char_indices_to_original};
|
||||
use crate::engine::util::{normalize_with_byte_mapping, normalize_with_char_mapping};
|
||||
use crate::engine::util::{
|
||||
map_byte_range_to_original, map_char_indices_to_original, normalize_with_byte_mapping, normalize_with_char_mapping,
|
||||
};
|
||||
use crate::{CaseMatching, MatchEngine, MatchEngineFactory, MatchRange, MatchResult, SkimItem};
|
||||
|
||||
/// Engine that normalizes text before matching
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ use regex::Regex;
|
|||
|
||||
use crate::engine::util::regex_match;
|
||||
use crate::item::RankBuilder;
|
||||
use crate::{CaseMatching, MatchEngine};
|
||||
use crate::{MatchRange, MatchResult, SkimItem};
|
||||
use crate::{CaseMatching, MatchEngine, MatchRange, MatchResult, SkimItem};
|
||||
use std::cmp::min;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -4,10 +4,8 @@
|
|||
//! fields from text based on delimiters.
|
||||
|
||||
use regex::Regex;
|
||||
use std::{
|
||||
cmp::{max, min},
|
||||
sync::LazyLock,
|
||||
};
|
||||
use std::cmp::{max, min};
|
||||
use std::sync::LazyLock;
|
||||
|
||||
static FIELD_RANGE: LazyLock<Regex> =
|
||||
LazyLock::new(|| Regex::new(r"^(?P<left>-?\d+)?(?P<sep>\.\.)?(?P<right>-?\d+)?$").unwrap());
|
||||
|
|
|
|||
|
|
@ -44,10 +44,8 @@ use self::constants::{CAMEL_CASE_BONUS, START_OF_STRING_BONUS};
|
|||
use self::prefilter::cheap_typo_prefilter;
|
||||
|
||||
use self::matrix::{CELL_ZERO, Cell, Dir, SWMatrix};
|
||||
use crate::{
|
||||
CaseMatching,
|
||||
fuzzy_matcher::{FuzzyMatcher, MatchIndices, ScoreType},
|
||||
};
|
||||
use crate::CaseMatching;
|
||||
use crate::fuzzy_matcher::{FuzzyMatcher, MatchIndices, ScoreType};
|
||||
|
||||
type Score = i16;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
//! Matcher using <https://crates.io/crates/frizbee>
|
||||
use frizbee::{Scoring, smith_waterman::SmithWatermanMatcher};
|
||||
use frizbee::Scoring;
|
||||
use frizbee::smith_waterman::SmithWatermanMatcher;
|
||||
|
||||
use crate::{
|
||||
CaseMatching,
|
||||
fuzzy_matcher::{FuzzyMatcher, MatchIndices, ScoreType},
|
||||
};
|
||||
use crate::CaseMatching;
|
||||
use crate::fuzzy_matcher::{FuzzyMatcher, MatchIndices, ScoreType};
|
||||
|
||||
const RESPECT_CASE_BONUS: u16 = 10000;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,8 @@ use std::process::Command;
|
|||
use std::sync::Arc;
|
||||
|
||||
use crate::fuzzy_matcher::MatchIndices;
|
||||
use ratatui::{
|
||||
style::Style,
|
||||
text::{Line, Span},
|
||||
};
|
||||
use ratatui::style::Style;
|
||||
use ratatui::text::{Line, Span};
|
||||
|
||||
pub use crate::engine::fuzzy::FuzzyAlgorithm;
|
||||
pub use crate::item::RankCriteria;
|
||||
|
|
|
|||
|
|
@ -15,12 +15,10 @@ use crate::binds::KeyMap;
|
|||
use crate::item::RankCriteria;
|
||||
use crate::prelude::SkimItemReader;
|
||||
use crate::reader::CommandCollector;
|
||||
use crate::tui::BorderType;
|
||||
use crate::tui::PreviewCallback;
|
||||
use crate::tui::event::Action;
|
||||
use crate::tui::options::{PreviewLayout, TuiLayout};
|
||||
use crate::tui::statusline::Info;
|
||||
use crate::tui::statusline::InfoDisplay;
|
||||
use crate::tui::statusline::{Info, InfoDisplay};
|
||||
use crate::tui::{BorderType, PreviewCallback};
|
||||
use crate::util::read_file_lines;
|
||||
use crate::{CaseMatching, FuzzyAlgorithm, Selector, Typos};
|
||||
|
||||
|
|
|
|||
|
|
@ -6,27 +6,22 @@
|
|||
mod tmux;
|
||||
mod zellij;
|
||||
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fmt::Write as FmtWrite,
|
||||
io::{BufRead as _, BufReader, BufWriter, IsTerminal as _, Write as _},
|
||||
process::ExitStatus,
|
||||
sync::{
|
||||
Arc,
|
||||
atomic::{AtomicBool, Ordering},
|
||||
},
|
||||
thread,
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Write as FmtWrite;
|
||||
use std::io::{BufRead as _, BufReader, BufWriter, IsTerminal as _, Write as _};
|
||||
use std::process::ExitStatus;
|
||||
use std::sync::Arc;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::thread;
|
||||
|
||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||
use nix::sys::stat::Mode;
|
||||
use nix::unistd::mkfifo;
|
||||
|
||||
use crate::{
|
||||
Rank, SkimItem, SkimOptions, SkimOutput,
|
||||
item::{MatchedItem, RankBuilder},
|
||||
tui::{Event, event::Action},
|
||||
};
|
||||
use crate::item::{MatchedItem, RankBuilder};
|
||||
use crate::tui::Event;
|
||||
use crate::tui::event::Action;
|
||||
use crate::{Rank, SkimItem, SkimOptions, SkimOutput};
|
||||
|
||||
use tmux::TmuxPopup;
|
||||
use zellij::ZellijPopup;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
use super::{PopupWindowDir, SkimPopup};
|
||||
use crate::{SkimOptions, tui::Size};
|
||||
use crate::SkimOptions;
|
||||
use crate::tui::Size;
|
||||
|
||||
use std::fmt::Write as _;
|
||||
use std::process::{Command, ExitStatus, Stdio};
|
||||
|
|
|
|||
|
|
@ -3,17 +3,16 @@
|
|||
//! This module provides a convenient way to import all the commonly used
|
||||
//! skim types and traits with a single `use skim::prelude::*;` statement.
|
||||
|
||||
pub use crate::engine::{
|
||||
factory::*,
|
||||
fuzzy::{FuzzyAlgorithm, FuzzyEngine},
|
||||
};
|
||||
pub use crate::engine::factory::*;
|
||||
pub use crate::engine::fuzzy::{FuzzyAlgorithm, FuzzyEngine};
|
||||
pub use crate::fuzzy_matcher::skim::SkimMatcherV2;
|
||||
pub use crate::helper::item_reader::{SkimItemReader, SkimItemReaderOption};
|
||||
pub use crate::helper::selector::DefaultSkimSelector;
|
||||
pub use crate::options::{SkimOptions, SkimOptionsBuilder};
|
||||
pub use crate::output::SkimOutput;
|
||||
pub use crate::reader::CommandCollector;
|
||||
pub use crate::tui::{Event, PreviewCallback, event::Action};
|
||||
pub use crate::tui::event::Action;
|
||||
pub use crate::tui::{Event, PreviewCallback};
|
||||
pub use crate::*;
|
||||
pub use kanal::{Receiver, Sender, bounded, unbounded};
|
||||
pub use std::borrow::Cow;
|
||||
|
|
|
|||
11
src/skim.rs
11
src/skim.rs
|
|
@ -3,15 +3,16 @@ use std::io::{BufWriter, Stderr};
|
|||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use color_eyre::eyre::Result;
|
||||
use color_eyre::eyre::{self, OptionExt};
|
||||
use color_eyre::eyre::{self, OptionExt, Result};
|
||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||
use ratatui_image::picker::Picker;
|
||||
use tokio::{runtime::Handle, select, task::block_in_place};
|
||||
use tokio::runtime::Handle;
|
||||
use tokio::select;
|
||||
use tokio::task::block_in_place;
|
||||
|
||||
use crate::reader::{Reader, ReaderControl};
|
||||
use crate::tui::TICK_RATE;
|
||||
use crate::tui::{App, Event, Size, Tui, event::Action};
|
||||
use crate::tui::event::Action;
|
||||
use crate::tui::{App, Event, Size, TICK_RATE, Tui};
|
||||
use crate::{SkimItem, SkimItemReceiver, SkimOptions, SkimOutput};
|
||||
|
||||
/// Main entry point for running skim
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
use ratatui::text::Line;
|
||||
use std::{
|
||||
borrow::Cow,
|
||||
fmt::{Debug, Display},
|
||||
};
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::{Debug, Display};
|
||||
|
||||
use crate::{AsAny, DisplayContext, ItemPreview, PreviewContext};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,8 @@
|
|||
//! 2. Use `.lock()` instead of `.lock().unwrap()` to retrieve the guard.
|
||||
//! 3. It doesn't handle poison so data is still available on thread panic.
|
||||
use std::cell::UnsafeCell;
|
||||
use std::ops::Deref;
|
||||
use std::ops::DerefMut;
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
/// A spin lock that uses busy-waiting instead of OS blocking
|
||||
#[derive(Default)]
|
||||
|
|
|
|||
|
|
@ -12,15 +12,12 @@ use crate::tui::options::TuiLayout;
|
|||
use crate::tui::statusline::InfoDisplay;
|
||||
use crate::tui::widget::SkimWidget;
|
||||
use crate::tui::{SkimRender, TICK_RATE};
|
||||
use crate::{ItemPreview, PreviewContext, SkimItem, SkimOptions};
|
||||
use crate::{Rank, util};
|
||||
use crate::{ItemPreview, PreviewContext, Rank, SkimItem, SkimOptions, util};
|
||||
|
||||
use super::Event;
|
||||
use super::Tui;
|
||||
use super::event::Action;
|
||||
use super::header::Header;
|
||||
use super::item_list::ItemList;
|
||||
use super::{input, preview};
|
||||
use super::{Event, Tui, input, preview};
|
||||
use crate::thread_pool::{self, ThreadPool};
|
||||
use color_eyre::eyre::{Result, bail};
|
||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers, MouseButton, MouseEvent, MouseEventKind};
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ use std::ops::{Deref, DerefMut};
|
|||
use std::sync::Once;
|
||||
|
||||
use color_eyre::eyre::Result;
|
||||
use crossterm::event::KeyEventKind;
|
||||
use crossterm::event::{DisableBracketedPaste, EnableBracketedPaste};
|
||||
use crossterm::event::{DisableMouseCapture, EnableMouseCapture};
|
||||
use crossterm::event::{
|
||||
DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, KeyEventKind,
|
||||
};
|
||||
use crossterm::terminal::{Clear, ClearType, EnterAlternateScreen, LeaveAlternateScreen};
|
||||
use crossterm::{self, cursor};
|
||||
use futures::{FutureExt as _, StreamExt as _};
|
||||
|
|
|
|||
|
|
@ -1,24 +1,18 @@
|
|||
//! Header display widget for skim's TUI.
|
||||
//!
|
||||
//! This module provides the header widget that displays static text above the item list.
|
||||
use crate::DisplayContext;
|
||||
use crate::SkimItem;
|
||||
use crate::SkimOptions;
|
||||
use crate::theme::ColorTheme;
|
||||
use crate::tui::BorderType;
|
||||
use crate::tui::options::TuiLayout;
|
||||
use crate::tui::util::char_display_width;
|
||||
use crate::tui::util::clip_line_to_chars;
|
||||
use crate::tui::util::style_line;
|
||||
use crate::tui::util::style_text;
|
||||
use crate::tui::util::{char_display_width, clip_line_to_chars, style_line, style_text};
|
||||
use crate::tui::widget::{SkimRender, SkimWidget};
|
||||
use crate::{DisplayContext, SkimItem, SkimOptions};
|
||||
|
||||
use ansi_to_tui::IntoText;
|
||||
use ratatui::buffer::Buffer;
|
||||
use ratatui::layout::Rect;
|
||||
use ratatui::text::{Line, Span, Text};
|
||||
use ratatui::widgets::Widget;
|
||||
use ratatui::widgets::{Block, Borders, Paragraph};
|
||||
use ratatui::widgets::{Block, Borders, Paragraph, Widget};
|
||||
use std::cmp::max;
|
||||
use std::sync::Arc;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,16 +4,18 @@ use std::sync::Arc;
|
|||
use std::time::Instant;
|
||||
|
||||
use ansi_to_tui::IntoText;
|
||||
use ratatui::{prelude::*, widgets::Widget};
|
||||
use ratatui::prelude::*;
|
||||
use ratatui::widgets::Widget;
|
||||
use unicode_display_width::width as display_width;
|
||||
|
||||
use crate::SkimOptions;
|
||||
use crate::helper::item::strip_ansi;
|
||||
use crate::theme::ColorTheme;
|
||||
use crate::tui::BorderType;
|
||||
use crate::tui::options::TuiLayout;
|
||||
use crate::tui::statusline::{Info, InfoDisplay, spinner_char};
|
||||
use crate::tui::util::style_line;
|
||||
use crate::tui::widget::{SkimRender, SkimWidget};
|
||||
use crate::{SkimOptions, theme::ColorTheme};
|
||||
|
||||
/// Status information to display in the input widget's title
|
||||
#[derive(Clone, Default)]
|
||||
|
|
@ -434,8 +436,7 @@ impl SkimWidget for Input {
|
|||
fn render(&mut self, area: Rect, buf: &mut Buffer) -> SkimRender {
|
||||
use ratatui::layout::Alignment;
|
||||
use ratatui::text::{Line, Span};
|
||||
use ratatui::widgets::Paragraph;
|
||||
use ratatui::widgets::{Block, Borders};
|
||||
use ratatui::widgets::{Block, Borders, Paragraph};
|
||||
|
||||
let mut line = self.prompt.into_text().map_or_else(
|
||||
|_| Line::from(self.prompt.as_str()),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
use std::{rc::Rc, sync::Arc};
|
||||
use std::rc::Rc;
|
||||
use std::sync::Arc;
|
||||
|
||||
use indexmap::IndexSet;
|
||||
use ratatui::widgets::{
|
||||
|
|
@ -7,17 +8,15 @@ use ratatui::widgets::{
|
|||
};
|
||||
use regex::Regex;
|
||||
|
||||
use crate::item::MatchedItem;
|
||||
use crate::options::feature_flag;
|
||||
use crate::{
|
||||
Selector, SkimOptions,
|
||||
item::MatchedItem,
|
||||
spinlock::SpinLock,
|
||||
theme::ColorTheme,
|
||||
tui::BorderType,
|
||||
tui::item_renderer::ItemRenderer,
|
||||
tui::options::TuiLayout,
|
||||
tui::widget::{SkimRender, SkimWidget},
|
||||
};
|
||||
use crate::spinlock::SpinLock;
|
||||
use crate::theme::ColorTheme;
|
||||
use crate::tui::BorderType;
|
||||
use crate::tui::item_renderer::ItemRenderer;
|
||||
use crate::tui::options::TuiLayout;
|
||||
use crate::tui::widget::{SkimRender, SkimWidget};
|
||||
use crate::{Selector, SkimOptions};
|
||||
|
||||
/// How to apply processed items to the display list
|
||||
#[derive(Default, Clone, Copy)]
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ use ratatui::text::{Line, Span};
|
|||
use ratatui::widgets::{ListDirection, ListItem};
|
||||
use unicode_display_width::width as display_width;
|
||||
|
||||
use crate::item::MatchedItem;
|
||||
use crate::theme::ColorTheme;
|
||||
use crate::tui::item_list::ItemList;
|
||||
use crate::tui::util::{char_display_width, clip_line_to_chars, wrap_text};
|
||||
use crate::{DisplayContext, MatchRange, item::MatchedItem, theme::ColorTheme};
|
||||
use crate::{DisplayContext, MatchRange};
|
||||
|
||||
#[allow(clippy::struct_excessive_bools)]
|
||||
struct SubLineState {
|
||||
|
|
|
|||
|
|
@ -1,23 +1,21 @@
|
|||
use ansi_to_tui::IntoText;
|
||||
use color_eyre::eyre::{Result, eyre};
|
||||
use portable_pty::{PtyPair, PtySize, native_pty_system};
|
||||
use ratatui::{
|
||||
layout::Alignment,
|
||||
prelude::Backend,
|
||||
style::Stylize,
|
||||
text::{Line, Text},
|
||||
widgets::{Block, Borders, Clear, Paragraph, Widget},
|
||||
};
|
||||
use ratatui::layout::Alignment;
|
||||
use ratatui::prelude::Backend;
|
||||
use ratatui::style::Stylize;
|
||||
use ratatui::text::{Line, Text};
|
||||
use ratatui::widgets::{Block, Borders, Clear, Paragraph, Widget};
|
||||
use ratatui_image::picker::Picker;
|
||||
use ratatui_image::protocol::Protocol as ImageProtocol;
|
||||
use tui_term::vt100;
|
||||
use tui_term::widget::PseudoTerminal;
|
||||
|
||||
use std::sync::mpsc;
|
||||
use std::sync::{Arc, RwLock};
|
||||
use std::env;
|
||||
use std::io::Read;
|
||||
use std::sync::{Arc, RwLock, mpsc};
|
||||
use std::thread::JoinHandle;
|
||||
use std::time::Instant;
|
||||
use std::{env, io::Read};
|
||||
|
||||
use super::statusline::spinner_char;
|
||||
use super::util::{find_csi_end, find_osc_end, handle_csi_query, handle_osc_query};
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
use crossterm::terminal;
|
||||
use ratatui::{
|
||||
style::Style,
|
||||
text::{Line, Span, Text},
|
||||
};
|
||||
use ratatui::style::Style;
|
||||
use ratatui::text::{Line, Span, Text};
|
||||
use std::io::{self, Write};
|
||||
#[cfg(unix)]
|
||||
use std::{
|
||||
|
|
@ -556,7 +554,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_merge_styles() {
|
||||
use ratatui::style::{Color::*, Modifier};
|
||||
use ratatui::style::Color::*;
|
||||
use ratatui::style::Modifier;
|
||||
let input = "before \x1b[1;34mline1\x1b[0m nocol";
|
||||
let styled = input.into_text().unwrap().lines[0].clone();
|
||||
let red = Style::new().red();
|
||||
|
|
@ -581,7 +580,8 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn test_style_text() {
|
||||
use ratatui::style::{Color::*, Modifier};
|
||||
use ratatui::style::Color::*;
|
||||
use ratatui::style::Modifier;
|
||||
let input = "before \x1b[1;34mline1\x1b[0m nocol";
|
||||
let mut styled = input.into_text().unwrap();
|
||||
let red = Style::new().red();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
use crate::field::FieldRange;
|
||||
use crate::field::get_string_by_field;
|
||||
use crate::field::{FieldRange, get_string_by_field};
|
||||
use crate::helper::item::strip_ansi;
|
||||
use crate::item::MatchedItem;
|
||||
use regex::Regex;
|
||||
|
|
|
|||
|
|
@ -4,11 +4,10 @@ use clap::Parser;
|
|||
use color_eyre::Result;
|
||||
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
|
||||
use ratatui::backend::TestBackend;
|
||||
use skim::{
|
||||
Skim, SkimItemReceiver,
|
||||
prelude::*,
|
||||
tui::{Event, Size, Tui, event::Action},
|
||||
};
|
||||
use skim::prelude::*;
|
||||
use skim::tui::event::Action;
|
||||
use skim::tui::{Event, Size, Tui};
|
||||
use skim::{Skim, SkimItemReceiver};
|
||||
|
||||
/// A test harness for running skim TUI tests with insta snapshots.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
use std::{
|
||||
fmt::{Display, Formatter},
|
||||
fs::File,
|
||||
io::{BufReader, ErrorKind, Read, Result},
|
||||
path::Path,
|
||||
process::Command,
|
||||
thread::sleep,
|
||||
time::Duration,
|
||||
};
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::fs::File;
|
||||
use std::io::{BufReader, ErrorKind, Read, Result};
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
|
||||
use rand::RngExt as _;
|
||||
use rand::distr::Alphanumeric;
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@ mod common;
|
|||
use common::tmux::Keys::*;
|
||||
use common::tmux::TmuxController;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
use std::io::Result;
|
||||
use std::io::Write;
|
||||
use std::io::{Read, Result, Write};
|
||||
use std::path::Path;
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -7,11 +7,10 @@
|
|||
mod common;
|
||||
|
||||
use common::tmux::Keys::*;
|
||||
use rand::{RngExt as _, distr::Alphabetic};
|
||||
use std::{
|
||||
io::{Result, Write as _},
|
||||
process::{Child, Command, Stdio},
|
||||
};
|
||||
use rand::RngExt as _;
|
||||
use rand::distr::Alphabetic;
|
||||
use std::io::{Result, Write as _};
|
||||
use std::process::{Child, Command, Stdio};
|
||||
|
||||
use common::tmux::TmuxController;
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,8 @@ mod common;
|
|||
|
||||
use common::tmux::Keys::*;
|
||||
use common::tmux::TmuxController;
|
||||
use std::fs::File;
|
||||
use std::fs::Permissions;
|
||||
use std::io::Read;
|
||||
use std::io::Result;
|
||||
use std::io::Write;
|
||||
use std::fs::{File, Permissions};
|
||||
use std::io::{Read, Result, Write};
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::path::Path;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue