@@ -108,7 +108,7 @@ pub fn print_dired_output(
108108}
109109
110110/// Helper function to print positions with a given prefix.
111- fn print_positions ( prefix : & str , positions : & Vec < BytePosition > ) {
111+ fn print_positions ( prefix : & str , positions : & [ BytePosition ] ) {
112112 print ! ( "{prefix}" ) ;
113113 for c in positions {
114114 print ! ( " {c}" ) ;
@@ -117,16 +117,7 @@ fn print_positions(prefix: &str, positions: &Vec<BytePosition>) {
117117}
118118
119119pub fn add_total ( dired : & mut DiredOutput , total_len : usize ) {
120- if dired. padding == 0 {
121- // when dealing with " total: xx", it isn't part of the //DIRED//
122- // so, we just keep the size line to add it to the position of the next file
123- dired. padding = total_len + DIRED_TRAILING_OFFSET ;
124- } else {
125- // += because if we are in -R, we have " dir:\n total X". So, we need to take the
126- // previous padding too.
127- // and we already have the previous position in mind
128- dired. padding += total_len + DIRED_TRAILING_OFFSET ;
129- }
120+ dired. padding += total_len + DIRED_TRAILING_OFFSET ;
130121}
131122
132123// when using -R, we have the dirname. we need to add it to the padding
@@ -156,7 +147,7 @@ pub fn update_positions(dired: &mut DiredOutput, start: usize, end: usize, line_
156147 start : start + padding,
157148 end : end + padding,
158149 } ) ;
159- dired. line_offset = dired . line_offset + padding + line_len;
150+ dired. line_offset += padding + line_len;
160151 // Remove the previous padding
161152 dired. padding = 0 ;
162153}
0 commit comments