Skip to content

Commit 645ec78

Browse files
committed
ptx: add comment explaining file map lookup logic
1 parent 3ad0a21 commit 645ec78

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/uu/ptx/src/ptx.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,10 @@ fn write_traditional_output(
751751
}
752752

753753
for word_ref in words {
754+
// Since `ptx` accepts duplicate file arguments (e.g., `ptx file file`),
755+
// simply looking up by filename is ambiguous.
756+
// We use the `global_line_nr` (which is unique across the entire input stream)
757+
// to identify which file covers this line.
754758
let (_, file_map_value) = file_map
755759
.iter()
756760
.find(|(name, content)| {

0 commit comments

Comments
 (0)