Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ page](https://github.com/skim-rs/skim/blob/master/man/man1/sk.1) (`man sk`).

- When using the `--split-match` option, each part around spaces or `|` will be matched in a split way:
- If the option's value (defaulting to `:`) is absent from the query, do a normal match
- If it is present, match everything before to everything before it in the items, and everything after it (including potential other occurences of the delimiter) to the part after it in the items. This is particularly useful when piping in input from `rg` to match on both file name and content.
- If it is present, match everything before to everything before it in the items, and everything after it (including potential other occurrences of the delimiter) to the part after it in the items. This is particularly useful when piping in input from `rg` to match on both file name and content.

If you prefer using regular expressions, `skim` offers a `regex` mode:

Expand Down
2 changes: 1 addition & 1 deletion bin/sk-tmux
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# sk-tmux: starts sk in a tmux pane
# usage: sk-tmux [LAYOUT OPTIONS] [--] [SK OPTIONS]

echo "[WRN] This script is deprecated in favor or \`sk --tmux\` and will be removed in a later release" >&2
echo "[WRN] This script is deprecated in favor of \`sk --tmux\` and will be removed in a later release" >&2

fail() {
>&2 echo "$1"
Expand Down
4 changes: 2 additions & 2 deletions man/man1/sk.1
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ Start in regex mode instead of fuzzy\-match
Fuzzy matching algorithm

arinae (ari) Latest algorithm
skim_v2 Legacy skim algorithm
`skim_v2` Legacy skim algorithm
clangd Used in clangd for keyword completion
fzy Algorithm from fzy (https://github.com/jhawthorn/fzy)
fzy Algorithm from fzy (<https://github.com/jhawthorn/fzy>)
.br

.br
Expand Down
22 changes: 11 additions & 11 deletions src/helper/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ impl SkimItem for DefaultSkimItem {
// Combine styles: use highlight bg, preserve ANSI fg and modifiers
new_spans.push(Span::styled(
highlighted_content.clone(),
merge_styles(base_style, context.matched_syle),
merge_styles(base_style, context.matched_style),
));
highlighted_content.clear();
}
Expand All @@ -336,7 +336,7 @@ impl SkimItem for DefaultSkimItem {
// Combine styles: use highlight bg, preserve ANSI fg and modifiers
new_spans.push(Span::styled(
highlighted_content,
merge_styles(base_style, context.matched_syle),
merge_styles(base_style, context.matched_style),
));
}
}
Expand Down Expand Up @@ -373,10 +373,10 @@ impl SkimItem for DefaultSkimItem {
new_spans.push(Span::styled(before, merge_styles(context.base_style, base_style)));
}
if !highlighted.is_empty() {
// Combine ANSI style with context matched_syle
// Combine ANSI style with context matched_style
new_spans.push(Span::styled(
highlighted,
merge_styles(base_style, context.matched_syle),
merge_styles(base_style, context.matched_style),
));
}
if !after.is_empty() {
Expand Down Expand Up @@ -421,10 +421,10 @@ impl SkimItem for DefaultSkimItem {
new_spans.push(Span::styled(before, merge_styles(context.base_style, base_style)));
}
if !highlighted.is_empty() {
// Combine ANSI style with context matched_syle
// Combine ANSI style with context matched_style
new_spans.push(Span::styled(
highlighted,
merge_styles(base_style, context.matched_syle),
merge_styles(base_style, context.matched_style),
));
}
if !after.is_empty() {
Expand Down Expand Up @@ -667,7 +667,7 @@ mod test {
matches: Matches::CharRange(6, 10),
container_width: 80,
base_style: Style::default(),
matched_syle: Style::default().fg(Color::Yellow),
matched_style: Style::default().fg(Color::Yellow),
};

// display() should map the match positions back to the original ANSI text
Expand Down Expand Up @@ -705,7 +705,7 @@ mod test {
matches: Matches::CharIndices(vec![1, 2]),
container_width: 80,
base_style: Style::default(),
matched_syle: Style::default().fg(Color::Yellow),
matched_style: Style::default().fg(Color::Yellow),
};

// display() should map these to positions 6,7 in original text
Expand Down Expand Up @@ -772,7 +772,7 @@ mod test {
matches: Matches::CharIndices(vec![0]),
container_width: 80,
base_style: Style::default(),
matched_syle: Style::default().bg(Color::Yellow),
matched_style: Style::default().bg(Color::Yellow),
};

let line = item.display(context);
Expand Down Expand Up @@ -810,7 +810,7 @@ mod test {
matches: Matches::CharRange(1, 3),
container_width: 80,
base_style: Style::default(),
matched_syle: Style::default().bg(Color::Yellow),
matched_style: Style::default().bg(Color::Yellow),
};

let line = item.display(context);
Expand Down Expand Up @@ -850,7 +850,7 @@ mod test {
matches: Matches::ByteRange(1, 3),
container_width: 80,
base_style: Style::default(),
matched_syle: Style::default().bg(Color::Yellow),
matched_style: Style::default().bg(Color::Yellow),
};

let line = item.display(context);
Expand Down
2 changes: 1 addition & 1 deletion src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl RankBuilder {
///
/// The values are stored as-is; the tiebreak ordering and sign-flipping are
/// applied lazily by [`Rank::sort_key`] at comparison time.
/// The `index` will be overriden later
/// The `index` will be overridden later
#[must_use]
pub fn build_rank(&self, score: i32, begin: usize, end: usize, item_text: &str) -> Rank {
Rank {
Expand Down
17 changes: 13 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub struct DisplayContext {
/// The base style to apply to non-matched portions
pub base_style: Style,
/// The style to apply to matched portions
pub matched_syle: Style,
pub matched_style: Style,
}

impl DisplayContext {
Expand All @@ -147,7 +147,10 @@ impl DisplayContext {
res.push_span(Span::styled(span_content.collect::<String>(), self.base_style));
let highlighted_char = chars.next().unwrap_or_default().to_string();

res.push_span(Span::styled(highlighted_char, self.base_style.patch(self.matched_syle)));
res.push_span(Span::styled(
highlighted_char,
self.base_style.patch(self.matched_style),
));
prev_index = index + 1;
}
res.push_span(Span::styled(chars.collect::<String>(), self.base_style));
Expand All @@ -164,7 +167,10 @@ impl DisplayContext {
));
let highlighted_text = chars.by_ref().take(*end - *start).collect::<String>();

res.push_span(Span::styled(highlighted_text, self.base_style.patch(self.matched_syle)));
res.push_span(Span::styled(
highlighted_text,
self.base_style.patch(self.matched_style),
));
res.push_span(Span::styled(chars.collect::<String>(), self.base_style));
res
}
Expand All @@ -178,7 +184,10 @@ impl DisplayContext {
let highlighted_bytes = bytes.by_ref().take(*end - *start).collect();
let highlighted_text = String::from_utf8(highlighted_bytes).unwrap();

res.push_span(Span::styled(highlighted_text, self.base_style.patch(self.matched_syle)));
res.push_span(Span::styled(
highlighted_text,
self.base_style.patch(self.matched_style),
));
res.push_span(Span::styled(
String::from_utf8(bytes.collect()).unwrap(),
self.base_style,
Expand Down
4 changes: 2 additions & 2 deletions src/skim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Skim {
///
/// # Panics
///
/// Panics if the tui fails to initilize
/// Panics if the tui fails to initialize
pub fn run_with(options: SkimOptions, source: Option<SkimItemReceiver>) -> Result<SkimOutput> {
trace!("running skim");
let mut skim = Self::init(options, source)?;
Expand Down Expand Up @@ -348,7 +348,7 @@ where
let reader_control = self
.reader_control
.as_ref()
.expect("reader_control needs to be initilized using Skim::start");
.expect("reader_control needs to be initialized using Skim::start");
let app = &mut self.app;

// Filter mode: wait for all items to be read and matched, then return without entering TUI
Expand Down
2 changes: 1 addition & 1 deletion src/tui/item_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ impl SkimWidget for ItemList {
matches,
container_width,
base_style: if is_current { theme.current } else { theme.normal },
matched_syle: if is_current { theme.current_match } else { theme.matched },
matched_style: if is_current { theme.current_match } else { theme.matched },
});

if !wrap {
Expand Down
2 changes: 1 addition & 1 deletion src/tui/preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ impl Preview {
self.rows, self.cols
);
self.init_pty();
trace!("initalized pty");
trace!("initialized pty");
let mut shell_cmd = portable_pty::CommandBuilder::new("/bin/sh");
shell_cmd.env("ROWS", self.rows.to_string());
shell_cmd.env("COLUMNS", self.cols.to_string());
Expand Down
Loading