Skip to content

Commit

Permalink
ls rename the function for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Sep 20, 2023
1 parent 99e718b commit a416b41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/uu/ls/src/dired.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl fmt::Display for BytePosition {
static DIRED_TRAILING_OFFSET: usize = 2;

/// Calculates the byte positions for DIRED
pub fn calculate_dired_byte_positions(
pub fn calculate_dired(
output_display_len: usize,
dfn_len: usize,
dired_positions: &[BytePosition],
Expand Down Expand Up @@ -143,12 +143,11 @@ mod tests {
use super::*;

#[test]
fn test_calculate_dired_byte_positions() {
fn test_calculate_dired() {
let output_display = "sample_output".to_string();
let dfn = "sample_file".to_string();
let dired_positions = vec![BytePosition { start: 5, end: 10 }];
let (start, end) =
calculate_dired_byte_positions(output_display.len(), dfn.len(), &dired_positions);
let (start, end) = calculate_dired(output_display.len(), dfn.len(), &dired_positions);

assert_eq!(start, 24);
assert_eq!(end, 35);
Expand Down
2 changes: 1 addition & 1 deletion src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2545,7 +2545,7 @@ fn display_item_long(

let displayed_file = display_file_name(item, config, None, String::new(), out).contents;
if config.dired {
let (start, end) = dired::calculate_dired_byte_positions(
let (start, end) = dired::calculate_dired(
output_display.len(),
displayed_file.len(),
&dired.dired_positions,
Expand Down

0 comments on commit a416b41

Please sign in to comment.