mirror of
https://github.com/lotabout/skim.git
synced 2026-09-10 07:16:23 -04:00
* fix: refresh preview after mouse selection * Address mouse preview review feedback * feat(ci): upload coverage report to pages for easier browsing (#1096) * feat(ci): upload coverage report to pages for easier browsing * fix: remove anchors * fix: release report * fix: coverage percent * docs: update README * chore: only on master * test: add unit tests for the shell & manpage generators (#1098) * test: add unit tests for the shell & manpage generators * chore: propagate key bindings generation errors * tests: improve coverage to 90% (#1099) * tests: improve coverage to 90% * feat: improve coverage * remove most unix-only tests * Update src/skim_tests.rs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fixes * chore: misc --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: cleanup --------- Co-authored-by: LoricAndre <57358788+LoricAndre@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Loric ANDRE <loric.andre@pm.me>
51 lines
1.2 KiB
Rust
51 lines
1.2 KiB
Rust
#![allow(missing_docs, clippy::pedantic)]
|
|
|
|
#[allow(dead_code)]
|
|
#[macro_use]
|
|
mod common;
|
|
|
|
use crossterm::event::{KeyModifiers, MouseButton, MouseEvent, MouseEventKind};
|
|
use ratatui::layout::Rect;
|
|
use skim::tui::BorderType;
|
|
|
|
fn mouse_down(column: u16, row: u16) -> MouseEvent {
|
|
MouseEvent {
|
|
kind: MouseEventKind::Down(MouseButton::Left),
|
|
column,
|
|
row,
|
|
modifiers: KeyModifiers::NONE,
|
|
}
|
|
}
|
|
|
|
fn list_inner_area(h: &common::insta::TestHarness) -> Rect {
|
|
let app = h.skim.app();
|
|
let list_area = app.layout.list_area;
|
|
|
|
if !matches!(app.options.border, BorderType::None | BorderType::ForceOff) {
|
|
return Rect {
|
|
x: list_area.x + 1,
|
|
y: list_area.y + 1,
|
|
width: list_area.width.saturating_sub(2),
|
|
height: list_area.height.saturating_sub(2),
|
|
};
|
|
}
|
|
|
|
list_area
|
|
}
|
|
|
|
fn mouse_down_list_row(h: &common::insta::TestHarness, row: u16) -> MouseEvent {
|
|
let inner = list_inner_area(h);
|
|
mouse_down(inner.x, inner.y + row)
|
|
}
|
|
|
|
insta_test!(
|
|
mouse_selection_refreshes_preview,
|
|
["first", "second", "third"],
|
|
&["--layout", "reverse", "--preview", "echo preview:{}"],
|
|
{
|
|
@snap;
|
|
@mouse(|h| mouse_down_list_row(h, 1));
|
|
@snap;
|
|
}
|
|
);
|