Skip to content

Commit

Permalink
[fix] Change selection when the resize event happens (#128)
Browse files Browse the repository at this point in the history
If the `selection` remains when the resize event happens, selected
cursor sometimes disappears. This patch tries to keep the selection
within the window.
  • Loading branch information
yykamei authored Jul 12, 2021
1 parent ee32dc9 commit 5086b4d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ pub fn entrypoint(args: ArgsOs, stdout: &mut impl Write) -> Result<()> {
} else if let Event::Resize(c, r) = ev {
columns = c;
rows = r;
selection = if selection > r {
paths_rows(r) - 1
} else {
selection
};
paths = find_paths(&starting_point, &query, paths_rows(rows))?;
state = State::PathsChanged;
}
Expand Down

0 comments on commit 5086b4d

Please sign in to comment.