Skip to content

Commit

Permalink
version 1.41.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Canop committed Aug 4, 2024
1 parent b197512 commit 7b2663b
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 37 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### next
### v1.41.0 - 2024-08-04
<a name="v1.41.0"></a>
#### Major Feature: :search_again
ctrl-s now triggers `:search_again` which either
- brings back the last used search pattern, when no filtering pattern is active
Expand All @@ -13,6 +14,7 @@ See http://dystroy.org/broot/panels/#resize-panels
- when git file infos are shown, and git ignored files aren't hidden, those files are flagged with a 'I' - Fix #916
- Remove .bak extension from content search exclusion list - Fix #915
- Update nerdfont and vscode icons - Thanks @jpaju
- `{initial-root}` verb argument

### v1.40.0 - 2024-07-16
<a name="v1.40.0"></a>
Expand Down
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "broot"
version = "1.40.1-dev"
version = "1.41.0"
authors = ["dystroy <denys.seguret@gmail.com>"]
repository = "https://github.com/Canop/broot"
homepage = "https://dystroy.org/broot"
Expand Down Expand Up @@ -41,7 +41,7 @@ glob = "0.3"
id-arena = "2.2.1"
image = "0.24"
include_dir = "0.7"
lazy-regex = "3.1.0"
lazy-regex = "3.2"
libc = "0.2"
memmap2 = "0.9"
once_cell = "1.18" # waiting for https://github.com/rust-lang/rust/issues/109736
Expand Down
1 change: 1 addition & 0 deletions bacon.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ command = [
"-A", "clippy::needless_range_loop",
"-A", "clippy::neg_multiply",
"-A", "clippy::vec_init_then_push",
"-W", "clippy::explicit_iter_loop",
]
need_stdout = false

Expand Down
8 changes: 4 additions & 4 deletions src/app/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use {
},
std::{
io::Write,
path::PathBuf,
path::{Path, PathBuf},
str::FromStr,
sync::{
Arc,
Expand Down Expand Up @@ -280,7 +280,7 @@ impl App {
if let Some(preview_id) = self.preview_panel {
for (idx, panel) in self.panels.iter().enumerate() {
if self.active_panel_idx != idx && panel.id != preview_id {
return panel.state().selected_path().map(|p| p.to_path_buf());
return panel.state().selected_path().map(Path::to_path_buf);
}
}
}
Expand All @@ -290,7 +290,7 @@ impl App {
self.panels[non_focused_panel_idx]
.state()
.selected_path()
.map(|p| p.to_path_buf())
.map(Path::to_path_buf)
} else {
None
}
Expand Down Expand Up @@ -774,7 +774,7 @@ impl App {
}

fn has_pending_task(&mut self) -> bool {
self.panels.iter().any(|p| p.has_pending_task())
self.panels.iter().any(Panel::has_pending_task)
}

/// This is the main loop of the application
Expand Down
4 changes: 2 additions & 2 deletions src/app/app_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ impl AppContext {
let search_modes = config
.search_modes
.as_ref()
.map(|map| map.try_into())
.map(TryInto::try_into)
.transpose()?
.unwrap_or_default();
let ext_colors = ExtColorMap::try_from(&config.ext_colors)
Expand Down Expand Up @@ -248,7 +248,7 @@ impl AppContext {
pub fn cmd(&self) -> Option<&str> {
self.launch_args.cmd.as_ref().or(
self.config_default_args.as_ref().and_then(|args| args.cmd.as_ref())
).map(|s| s.as_str())
).map(String::as_str)
}
pub fn initial_mode(&self) -> Mode {
if self.modal {
Expand Down
3 changes: 1 addition & 2 deletions src/app/panel_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,7 @@ pub trait PanelState {
} else {
let line = input_invocation
.and_then(|inv| inv.args.as_ref())
.map(|s| s.as_str())
.unwrap_or("");
.map_or("", String::as_str);
verb_write(con, line)?;
}
CmdResult::Keep
Expand Down
2 changes: 1 addition & 1 deletion src/app/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl<'a> SelInfo<'a> {
SelInfo::None => true,
SelInfo::One(sel) => condition.accepts_path(sel.path),
SelInfo::More(stage) => {
for path in stage.paths().iter() {
for path in stage.paths() {
if !condition.accepts_path(path) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions src/browser/browser_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl PanelState for BrowserState {
}
Internal::next_dir => {
self.displayed_tree_mut().try_select_next_filtered(
|line| line.is_dir(),
TreeLine::is_dir,
page_height,
);
CmdResult::Keep
Expand Down Expand Up @@ -474,7 +474,7 @@ impl PanelState for BrowserState {
Internal::parent => self.go_to_parent(screen, con, bang),
Internal::previous_dir => {
self.displayed_tree_mut().try_select_previous_filtered(
|line| line.is_dir(),
TreeLine::is_dir,
page_height,
);
CmdResult::Keep
Expand Down
2 changes: 1 addition & 1 deletion src/command/panel_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl PanelInput {
sel_info: SelInfo<'_>,
panel_state_type: PanelStateType,
) -> Option<&'c Verb> {
for verb in con.verb_store.verbs().iter() {
for verb in con.verb_store.verbs() {
// note that there can be several verbs with the same key and
// not all of them can apply
if !verb.keys.contains(&key) {
Expand Down
2 changes: 1 addition & 1 deletion src/help/help_verbs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn matching_verb_rows<'v>(
con: &'v AppContext,
) -> Vec<MatchingVerbRow<'v>> {
let mut rows = Vec::new();
for verb in con.verb_store.verbs().iter() {
for verb in con.verb_store.verbs() {
if !verb.show_in_doc {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/kitty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl KittyManager {
kept_id: KittyImageId,
drawing_count: usize,
) {
for image in self.rendered_images.iter_mut() {
for image in &mut self.rendered_images {
if image.image_id == kept_id {
image.drawing_count = drawing_count;
}
Expand Down
2 changes: 1 addition & 1 deletion src/pattern/fuzzy_pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct FuzzyPattern {

impl fmt::Display for FuzzyPattern {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
for &c in self.chars.iter() {
for &c in &self.chars {
f.write_char(c)?
}
Ok(())
Expand Down
8 changes: 4 additions & 4 deletions src/preview/preview_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use {
};

/// an application state dedicated to previewing files.
/// It's usually the only state in its panel and is kept when
/// the selection changes (other panels indirectly call
/// set_selected_path).
///
/// It's usually the only state in its panel and is kept when the
/// selection changes (other panels indirectly call `set_selected_path`).
pub struct PreviewState {
pub preview_area: Area,
dirty: bool, // true when background must be cleared
Expand Down Expand Up @@ -200,7 +200,7 @@ impl PanelState for PreviewState {
self.pending_pattern = fp.pattern();
};
self.transform = con.preview_transformers.transform(&path, self.preferred_mode);
let preview_path = self.transform.as_ref().map(|c| &c.output_path).unwrap_or(&path);
let preview_path = self.transform.as_ref().map_or(&path, |c| &c.output_path);
self.preview = Preview::new(preview_path, self.preferred_mode, con);
if let Some(number) = selected_line_number {
self.preview.try_select_line_number(number);
Expand Down
4 changes: 2 additions & 2 deletions src/print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn print_paths(sel_info: SelInfo, con: &AppContext) -> io::Result<CmdResult>
SelInfo::One(sel) => sel.path.to_string_lossy().to_string(),
SelInfo::More(stage) => {
let mut string = String::new();
for path in stage.paths().iter() {
for path in stage.paths() {
string.push_str(&path.to_string_lossy());
string.push('\n');
}
Expand Down Expand Up @@ -67,7 +67,7 @@ pub fn print_relative_paths(sel_info: SelInfo, con: &AppContext) -> io::Result<C
SelInfo::One(sel) => relativize_path(sel.path, con)?,
SelInfo::More(stage) => {
let mut string = String::new();
for path in stage.paths().iter() {
for path in stage.paths() {
string.push_str(&relativize_path(path, con)?);
string.push('\n');
}
Expand Down
4 changes: 2 additions & 2 deletions src/stage/filtered_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {
},
std::{
convert::TryFrom,
path::Path,
path::{Path, PathBuf},
},
};

Expand Down Expand Up @@ -93,7 +93,7 @@ impl FilteredStage {
self.paths_idx
.get(idx)
.and_then(|&idx| stage.paths().get(idx))
.map(|p| p.as_path())
.map(PathBuf::as_path)
}
pub fn path_sel<'s>(&self, stage: &'s Stage, idx: usize) -> Option<(&'s Path, bool)> {
self.path(stage, idx)
Expand Down
4 changes: 2 additions & 2 deletions src/tree/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ impl Tree {
// - a node can come from a not parent node, when we followed a link
let mut bid_parents: FxHashMap<BId, BId> = FxHashMap::default();
let mut bid_lines: FxHashMap<BId, &TreeLine> = FxHashMap::default();
for line in self.lines[..].iter() {
for line in &self.lines[..] {
if let Some(parent_bid) = line.parent_bid {
bid_parents.insert(line.bid, parent_bid);
}
bid_lines.insert(line.bid, line);
}
let mut sort_paths: FxHashMap<BId, String> = FxHashMap::default();
for line in self.lines[1..].iter() {
for line in &self.lines[1..] {
let mut sort_path = String::new();
let mut bid = line.bid;
while let Some(l) = bid_lines.get(&bid) {
Expand Down
8 changes: 4 additions & 4 deletions src/tree_build/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ impl<'c> TreeBuilder<'c> {
out_blines: &[BId],
) {
let mut count = 1;
for id in out_blines[1..].iter() {
for id in &out_blines[1..] {
if self.blines[*id].has_match {
//debug!("bline before trimming: {:?}", &self.blines[*idx].path);
count += 1;
Expand All @@ -434,7 +434,7 @@ impl<'c> TreeBuilder<'c> {
}
}
let mut remove_queue: BinaryHeap<SortableBId> = BinaryHeap::new();
for id in out_blines[1..].iter() {
for id in &out_blines[1..] {
let bline = &self.blines[*id];
if bline.has_match
&& bline.nb_kept_children == 0
Expand Down Expand Up @@ -533,7 +533,7 @@ impl<'c> TreeBuilder<'c> {
out_blines: &[BId],
) -> Tree {
let mut lines: Vec<TreeLine> = Vec::new();
for id in out_blines.iter() {
for id in out_blines {
if self.blines[*id].has_match {
// we need to count the children, so we load them
if self.blines[*id].can_enter() && self.blines[*id].children.is_none() {
Expand Down Expand Up @@ -566,7 +566,7 @@ impl<'c> TreeBuilder<'c> {
tree.git_status = ComputationResult::NotComputed;
// it would make no sense to keep only files having a git status and
// not display that type
for line in tree.lines.iter_mut() {
for line in &mut tree.lines {
line.git_status = computer.line_status(&line.path);
}
}
Expand Down

0 comments on commit 7b2663b

Please sign in to comment.