Skip to content

Commit

Permalink
[PR] Run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardDRJ committed Jul 31, 2023
1 parent a2077a6 commit 514ffa5
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions atuin/src/command/client/search/interactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ impl State {
settings.max_preview_height,
v.command
.split('\n')
.map(|line| (line.len() as u16 + preview_width - 1 - border_size) / (preview_width - border_size))
.map(|line| {
(line.len() as u16 + preview_width - 1 - border_size)
/ (preview_width - border_size)
})
.sum(),
)
}) + border_size * 2
Expand Down Expand Up @@ -475,13 +478,15 @@ impl State {
} else {
use itertools::Itertools as _;
let s = &results[selected].command;
s.split('\n').flat_map(|line|
line.char_indices()
.step_by(preview_width.into())
.map(|(i, _)| i)
.chain(Some(line.len()))
.tuple_windows()
.map(|(a, b)| &line[a..b]))
s.split('\n')
.flat_map(|line| {
line.char_indices()
.step_by(preview_width.into())
.map(|(i, _)| i)
.chain(Some(line.len()))
.tuple_windows()
.map(|(a, b)| &line[a..b])
})
.join("\n")
};
let preview = if compact {
Expand Down

0 comments on commit 514ffa5

Please sign in to comment.