Skip to content

Commit 124d787

Browse files
committed
fix(ptx): Correct reference format for stdin
1 parent 1331ff1 commit 124d787

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/uu/ptx/src/ptx.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,15 @@ fn create_word_set(config: &Config, filter: &WordFilter, file_map: &FileMap) ->
352352

353353
fn get_reference(config: &Config, word_ref: &WordRef, line: &str, context_reg: &Regex) -> String {
354354
if config.auto_ref {
355-
format!(
356-
"{}:{}",
357-
word_ref.filename.maybe_quote(),
358-
word_ref.local_line_nr + 1
359-
)
355+
if word_ref.filename == "-" {
356+
format!(":{}", word_ref.local_line_nr + 1)
357+
} else {
358+
format!(
359+
"{}:{}",
360+
word_ref.filename.maybe_quote(),
361+
word_ref.local_line_nr + 1
362+
)
363+
}
360364
} else if config.input_ref {
361365
let (beg, end) = match context_reg.find(line) {
362366
Some(x) => (x.start(), x.end()),

0 commit comments

Comments
 (0)