mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-08 00:44:30 +01:00
Use first-line detection for STDIN
This commit is contained in:
parent
ce96df00b6
commit
e97095b724
@ -189,7 +189,9 @@ impl HighlightingAssets {
|
|||||||
let syntax = ext_syntax.or(line_syntax);
|
let syntax = ext_syntax.or(line_syntax);
|
||||||
syntax
|
syntax
|
||||||
}
|
}
|
||||||
(None, InputFile::StdIn) => None,
|
(None, InputFile::StdIn) => String::from_utf8(reader.first_line.clone())
|
||||||
|
.ok()
|
||||||
|
.and_then(|l| self.syntax_set.find_syntax_by_first_line(&l)),
|
||||||
(_, InputFile::ThemePreviewFile) => self.syntax_set.find_syntax_by_name("Rust"),
|
(_, InputFile::ThemePreviewFile) => self.syntax_set.find_syntax_by_name("Rust"),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user