Skip to content

Commit

Permalink
Merge branch 'help-language-consistency'
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Dec 27, 2023
2 parents c973826 + 20e85c1 commit 0a0dfe6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 53 deletions.
2 changes: 1 addition & 1 deletion src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub fn aggregate(
stats.entries_traversed += 1;
progress.throttled(|| {
if let Some(err) = err.as_mut() {
write!(err, "Enumerating {} entries\r", stats.entries_traversed).ok();
write!(err, "Enumerating {} items\r", stats.entries_traversed).ok();
}
});
match entry {
Expand Down
8 changes: 4 additions & 4 deletions src/interactive/app/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ impl AppState {
window.mark_pane = match res {
Some((pane, mode)) => match mode {
Some(MarkMode::Delete) => {
self.message = Some("Deleting entries...".to_string());
self.message = Some("Deleting items...".to_string());
let mut entries_deleted = 0;
let res = pane.iterate_deletable_items(|mut pane, entry_to_delete| {
window.mark_pane = Some(pane);
Expand All @@ -217,7 +217,7 @@ impl AppState {
Ok(ed) => {
entries_deleted += ed;
self.message =
Some(format!("Deleted {} entries...", entries_deleted));
Some(format!("Deleted {} items...", entries_deleted));
Ok(pane)
}
Err(c) => Err((pane, c)),
Expand All @@ -228,7 +228,7 @@ impl AppState {
}
#[cfg(feature = "trash-move")]
Some(MarkMode::Trash) => {
self.message = Some("Trashing entries...".to_string());
self.message = Some("Trashing items...".to_string());
let mut entries_trashed = 0;
let res = pane.iterate_deletable_items(|mut pane, entry_to_trash| {
window.mark_pane = Some(pane);
Expand All @@ -238,7 +238,7 @@ impl AppState {
Ok(ed) => {
entries_trashed += ed;
self.message =
Some(format!("Trashed {} entries...", entries_trashed));
Some(format!("Trashed {} items...", entries_trashed));
Ok(pane)
}
Err(c) => Err((pane, c)),
Expand Down
22 changes: 11 additions & 11 deletions src/interactive/app/tests/journeys_readonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
app.state.sorting,
SortMode::SizeDescending,
"it will sort entries in descending order by size"
"it will sort items in descending order by size"
);

assert!(
Expand Down Expand Up @@ -97,7 +97,7 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
node_by_index(&app, app.state.entries[0].index),
node_by_name(&app, fixture_str(long_root)),
"it recomputes the cached entries"
"it recomputes the cached items"
);
// when hitting the S key
app.process_events(&mut terminal, into_codes("s"))?;
Expand All @@ -109,7 +109,7 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
node_by_index(&app, app.state.entries[1].index),
node_by_name(&app, fixture_str(long_root)),
"it recomputes the cached entries"
"it recomputes the cached items"
);
// when hitting the S key again
app.process_events(&mut terminal, into_codes("s"))?;
Expand All @@ -125,7 +125,7 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
node_by_index(&app, app.state.entries[0].index),
node_by_name(&app, fixture_str(short_root)),
"it recomputes the cached entries"
"it recomputes the cached items"
);
}

Expand All @@ -136,7 +136,7 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
node_by_name(&app, fixture_str(long_root)),
node_by_index(&app, *app.state.navigation().selected.as_ref().unwrap()),
"it moves the cursor down and selects the next entry based on the current sort mode"
"it moves the cursor down and selects the next item based on the current sort mode"
);
// when hitting it while there is nowhere to go
app.process_events(&mut terminal, into_codes("j"))?;
Expand All @@ -150,7 +150,7 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
node_by_name(&app, fixture_str(short_root)),
node_by_index(&app, *app.state.navigation().selected.as_ref().unwrap()),
"it moves the cursor up and selects the next entry based on the current sort mode"
"it moves the cursor up and selects the next item based on the current sort mode"
);
// when hitting the k key again
app.process_events(&mut terminal, into_codes("k"))?;
Expand All @@ -166,12 +166,12 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
new_root_idx,
app.state.navigation().view_root,
"it enters the entry if it is a directory, changing the root"
"it enters the item if it is a directory, changing the root"
);
assert_eq!(
index_by_name(&app, "dir"),
*app.state.navigation().selected.as_ref().unwrap(),
"it selects the first entry in the directory"
"it selects the first item in the directory"
);

// when hitting the u key while inside a sub-directory
Expand All @@ -185,7 +185,7 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
node_by_name(&app, fixture_str(short_root)),
node_by_index(&app, *app.state.navigation().selected.as_ref().unwrap()),
"changes the selection to the first item in the list of entries"
"changes the selection to the first item in the list of items"
);
}
}
Expand Down Expand Up @@ -255,14 +255,14 @@ fn simple_user_journey_read_only() -> Result<()> {
assert_eq!(
Some(1),
app.window.mark_pane.as_ref().map(|p| p.marked().len()),
"it toggled the previous selected entry off",
"it toggled the previous selected item off",
);

assert!(
app.window.mark_pane.as_ref().map_or(false, |p| p
.marked()
.contains_key(&previously_selected_index)),
"it leaves the first selected entry marked"
"it leaves the first selected item marked"
);
}
// when hitting the spacebar (after moving up to the first entry)
Expand Down
4 changes: 2 additions & 2 deletions src/interactive/app/tests/journeys_with_writes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn basic_user_journey_with_deletion() -> Result<()> {
assert_eq!(
app.window.mark_pane.as_ref().map(|p| p.marked().len()),
Some(4),
"expecting 4 selected entries, the parent dir, and some children"
"expecting 4 selected items, the parent dir, and some children"
);

assert!(fixture.as_ref().is_dir(), "expecting fixture root to exist");
Expand All @@ -34,7 +34,7 @@ fn basic_user_journey_with_deletion() -> Result<()> {
)?;
assert!(
app.window.mark_pane.is_none(),
"the marker pane is gone as all entries have been removed"
"the marker pane is gone as all items have been removed"
);
assert_eq!(
app.state.navigation().selected,
Expand Down
2 changes: 1 addition & 1 deletion src/interactive/widgets/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Footer {

let spans = vec![
Span::from(format!(
"Sort mode: {} Total disk usage: {} Entries: {} {progress} ",
"Sort mode: {} Total disk usage: {} Items: {} {progress} ",
match sort_mode {
SortMode::SizeAscending => "size ascending",
SortMode::SizeDescending => "size descending",
Expand Down
72 changes: 38 additions & 34 deletions src/interactive/widgets/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,105 +106,109 @@ impl HelpPane {
}
};

title("Keys for pane control");
title("Pane control");
{
hotkey(
"q/<Esc>",
"Close the current pane. Closes the program if no",
Some("pane is open"),
"Close the current pane.",
Some("Closes the program if no pane is open."),
);
hotkey(
"<Tab>",
"Cycle between all open panes.",
Some("Activate 'Marked Items' pane to delete selected files."),
);
hotkey("?", "Show or hide the help pane", None);
hotkey("?", "Show or hide this help pane.", None);
spacer();
}
title("Keys for Navigation");
title("Navigation");
{
hotkey("j/<Down>", "move down an entry", None);
hotkey("k/<Up>", "move up an entry", None);
hotkey("o/l/<Enter>", "descent into the selected directory", None);
hotkey("j/<Down>", "Move down 1 item.", None);
hotkey("k/<Up>", "Move up 1 item.", None);
hotkey("o/l/<Enter>", "Descent into the selected directory.", None);
hotkey("<Right>", "^", None);
hotkey(
"u/h/<Left>",
"ascent one level into the parent directory",
"Ascent one level into the parent directory.",
None,
);
hotkey("<Backspace>", "^", None);
hotkey("Ctrl + d", "move down 10 entries at once", None);
hotkey("Ctrl + d", "Move down 10 items.", None);
hotkey("<Page Down>", "^", None);
hotkey("Ctrl + u", "move up 10 entries at once", None);
hotkey("Ctrl + u", "Move up 10 items.", None);
hotkey("<Page Up>", "^", None);
hotkey("H/<Home>", "Move to the top of the entries list", None);
hotkey("G/<End>", "Move to the bottom of the entries list", None);
hotkey("H/<Home>", "Move to the top of the list.", None);
hotkey("G/<End>", "Move to the bottom of the list.", None);
spacer();
}
title("Keys for display");
title("Display");
{
hotkey("s", "toggle sort by size ascending/descending", None);
hotkey("m", "toggle sort by mtime ascending/descending", None);
hotkey("c", "toggle sort by items ascending/descending", None);
hotkey("s", "Toggle sort by size descending/ascending.", None);
hotkey(
"m",
"Toggle sort by modified time descending/ascending.",
None,
);
hotkey("c", "Toggle sort by items descending/ascending.", None);
hotkey(
"g",
"cycle through percentage display and bar options",
"Cycle through percentage display and bar options.",
None,
);
spacer();
}
title("Keys for entry operations");
title("Open/Mark/Search");
{
hotkey(
"Shift + o",
"Open the entry with the associated program",
"Open the selected item with the associated program.",
None,
);
hotkey(
"d",
"Toggle the currently selected entry and move down",
"Toggle the currently selected item and move down.",
None,
);
hotkey(
"x",
"Mark the currently selected entry for deletion and move down",
"Mark the currently selected item for deletion and move down.",
None,
);
hotkey("<Space>", "Toggle the currently selected entry", None);
hotkey("a", "Toggle all entries", None);
hotkey("<Space>", "Toggle the currently selected item.", None);
hotkey("a", "Toggle all items.", None);
hotkey(
"/",
"Git-style glob search, case-insensitive, always from the top of the tree",
None,
"Git-style glob search, case-insensitive.",
Some("Search starts from the current directory."),
);
spacer();
}
title("Keys in the Mark pane");
title("Mark items pane");
{
hotkey(
"x/d/<Space>",
"Remove the selected entry from the list",
"Remove the selected item from the list.",
None,
);
hotkey("a", "Remove all entries from the list", None);
hotkey("a", "Remove all items from the list.", None);
hotkey(
"Ctrl + r",
"Permanently delete all marked entries without prompt!",
"Permanently delete all marked items without prompt.",
Some("This operation cannot be undone!"),
);
#[cfg(feature = "trash-move")]
hotkey(
"Ctrl + t",
"Move all marked entries to the trash bin",
Some("The entries can be restored from the trash bin"),
"Move all marked items to the trash bin.",
Some("The items can be restored from the trash bin."),
);
spacer();
}
title("Keys for application control");
title("Application control");
{
hotkey(
"Ctrl + c",
"close the application. No questions asked!",
"Close the application. No questions asked!",
None,
);
spacer();
Expand Down

0 comments on commit 0a0dfe6

Please sign in to comment.