1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-12 08:12:27 +01:00

Add first-line detection for all input types

closes #205
This commit is contained in:
sharkdp
2018-10-07 13:26:50 +02:00
committed by David Peter
parent 869cf6368c
commit 0502a3bd4a
3 changed files with 40 additions and 29 deletions

View File

@@ -15,7 +15,7 @@ use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineN
use diff::get_git_diff;
use diff::LineChanges;
use errors::*;
use inputfile::InputFile;
use inputfile::{InputFile, InputFileReader};
use preprocessor::expand;
use style::OutputWrap;
use terminal::{as_terminal_escaped, to_ansi_color};
@@ -74,7 +74,12 @@ pub struct InteractivePrinter<'a> {
}
impl<'a> InteractivePrinter<'a> {
pub fn new(config: &'a Config, assets: &'a HighlightingAssets, file: InputFile) -> Self {
pub fn new(
config: &'a Config,
assets: &'a HighlightingAssets,
file: InputFile,
reader: &mut InputFileReader,
) -> Self {
let theme = assets.get_theme(&config.theme);
let colors = if config.colored_output {
@@ -124,7 +129,7 @@ impl<'a> InteractivePrinter<'a> {
};
// Determine the type of syntax for highlighting
let syntax = assets.get_syntax(config.language, file);
let syntax = assets.get_syntax(config.language, file, reader);
let highlighter = HighlightLines::new(syntax, theme);
InteractivePrinter {