|
4 | 4 | // file that was distributed with this source code. |
5 | 5 | // spell-checker:ignore dired subdired |
6 | 6 |
|
| 7 | +/// `dired` Module Documentation |
| 8 | +/// |
| 9 | +/// This module handles the --dired output format, representing file and |
| 10 | +/// directory listings. |
| 11 | +/// |
| 12 | +/// Key Mechanisms: |
| 13 | +/// 1. **Position Tracking**: |
| 14 | +/// - The module tracks byte positions for each file or directory entry. |
| 15 | +/// - `BytePosition`: Represents a byte range with start and end positions. |
| 16 | +/// - `DiredOutput`: Contains positions for DIRED and SUBDIRED outputs and |
| 17 | +/// maintains a padding value. |
| 18 | +/// |
| 19 | +/// 2. **Padding**: |
| 20 | +/// - Padding is used when dealing with directory names or the "total" line. |
| 21 | +/// - The module adjusts byte positions by adding padding for these cases. |
| 22 | +/// - This ensures correct offset for subsequent files or directories. |
| 23 | +/// |
| 24 | +/// 3. **Position Calculation**: |
| 25 | +/// - Functions like `calculate_dired`, `calculate_subdired`, and |
| 26 | +/// `calculate_and_update_positions` compute byte positions based on output |
| 27 | +/// length, previous positions, and padding. |
| 28 | +/// |
| 29 | +/// 4. **Output**: |
| 30 | +/// - The module provides functions to print the DIRED output |
| 31 | +/// (`print_dired_output`) based on calculated positions and configuration. |
| 32 | +/// - Helpers like `print_positions` print positions with specific prefixes. |
| 33 | +/// |
| 34 | +/// Overall, the module ensures each entry in the DIRED output has the correct |
| 35 | +/// byte position, considering additional lines or padding affecting positions. |
| 36 | +/// |
7 | 37 | use crate::Config; |
8 | 38 | use std::fmt; |
9 | 39 | use std::io::{BufWriter, Stdout, Write}; |
|
0 commit comments