1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-29 00:22:26 +01:00

Merge branch 'master' into master

This commit is contained in:
John Cavanaugh
2025-08-13 23:27:26 -07:00
committed by GitHub
21 changed files with 369 additions and 171 deletions

View File

@@ -163,7 +163,7 @@ impl HighlightingAssets {
if let Some(MappingTarget::MapTo(syntax_name)) = syntax_match {
return self
.find_syntax_by_name(syntax_name)?
.find_syntax_by_token(syntax_name)?
.ok_or_else(|| Error::UnknownSyntax(syntax_name.to_owned()));
}
@@ -259,6 +259,13 @@ impl HighlightingAssets {
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
}
fn find_syntax_by_token(&self, token: &str) -> Result<Option<SyntaxReferenceInSet>> {
let syntax_set = self.get_syntax_set()?;
Ok(syntax_set
.find_syntax_by_token(token)
.map(|syntax| SyntaxReferenceInSet { syntax, syntax_set }))
}
fn get_syntax_for_file_name(
&self,
file_name: &OsStr,

View File

@@ -0,0 +1,5 @@
[mappings]
"INI" = [
"*.flatpakref",
"*.flatpakrepo"
]

View File

@@ -266,10 +266,10 @@ impl ColorSchemeDetector for TerminalColorSchemeDetector {
}
fn detect(&self) -> Option<ColorScheme> {
use terminal_colorsaurus::{color_scheme, ColorScheme as ColorsaurusScheme, QueryOptions};
match color_scheme(QueryOptions::default()).ok()? {
ColorsaurusScheme::Dark => Some(ColorScheme::Dark),
ColorsaurusScheme::Light => Some(ColorScheme::Light),
use terminal_colorsaurus::{theme_mode, QueryOptions, ThemeMode};
match theme_mode(QueryOptions::default()).ok()? {
ThemeMode::Dark => Some(ColorScheme::Dark),
ThemeMode::Light => Some(ColorScheme::Light),
}
}
}