Merge branch 'master' into master
This commit is contained in:
16 files changed
+142
-12
No files matched your search
@@ -0,0 +1,11 @@
|
|||||||
|
# On Windows MSVC, statically link the C runtime so that the resulting EXE does
|
||||||
|
# not depend on the vcruntime DLL.
|
||||||
|
#
|
||||||
|
# See: https://github.com/sharkdp/bat/issues/3634
|
||||||
|
|
||||||
|
[target.x86_64-pc-windows-msvc]
|
||||||
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
[target.i686-pc-windows-msvc]
|
||||||
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
|
[target.aarch64-pc-windows-msvc]
|
||||||
|
rustflags = ["-C", "target-feature=+crt-static"]
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
- Sanitize control characters in filenames before displaying them in the file header, error messages, and the terminal title, preventing ANSI escape injection via crafted filenames. Closes #3054, see #3691 (@curious-rabbit)
|
- Sanitize control characters in filenames before displaying them in the file header, error messages, and the terminal title, preventing ANSI escape injection via crafted filenames. Closes #3054, see #3691 (@curious-rabbit)
|
||||||
|
- Report initial input read errors instead of treating them as empty input. Closes #3002, see #3706 (@lawrence3699)
|
||||||
- Treat ZIP archives as binary content based on their magic header, see #3686 (@officialasishkumar)
|
- Treat ZIP archives as binary content based on their magic header, see #3686 (@officialasishkumar)
|
||||||
- Fix i686 `.deb` package using incorrect architecture name (`i686` instead of `i386`), preventing installation on Debian. Closes #3611, see #3650 (@Sim-hu)
|
- Fix i686 `.deb` package using incorrect architecture name (`i686` instead of `i386`), preventing installation on Debian. Closes #3611, see #3650 (@Sim-hu)
|
||||||
- Fix inconsistent `.deb` MUSL package names (aarch64-musl used `arm64` instead of `musl-linux-arm64`, and `musleabihf` target missed `bat-musl` prefix). Closes #3482, see #3642 (@mvanhorn)
|
- Fix inconsistent `.deb` MUSL package names (aarch64-musl used `arm64` instead of `musl-linux-arm64`, and `musleabihf` target missed `bat-musl` prefix). Closes #3482, see #3642 (@mvanhorn)
|
||||||
@@ -37,15 +38,18 @@
|
|||||||
- Fixed test compatibility with future Cargo build directory changes, see #3550 (@nmacl)
|
- Fixed test compatibility with future Cargo build directory changes, see #3550 (@nmacl)
|
||||||
- Fixed bug caused by using `--plain` and `--terminal-width=N` flags simultaneously, see #3529 (@H4k1l)
|
- Fixed bug caused by using `--plain` and `--terminal-width=N` flags simultaneously, see #3529 (@H4k1l)
|
||||||
- Fixed syntax tests path, see #3610 (@foxfromworld)
|
- Fixed syntax tests path, see #3610 (@foxfromworld)
|
||||||
|
- Fix zsh tab completion word-splitting language names containing spaces (e.g. `HTML (Jinja2)`, `Apache Conf`), see #3693 (@YoshKoz)
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
- Use git version of cross. See #3533 (@OctopusET)
|
- Use git version of cross. See #3533 (@OctopusET)
|
||||||
- Bump MSRV to 1.88, update `time` crate to 0.3.47 to fix RUSTSEC-2026-0009, see #3581 (@NORMAL-EX)
|
- Bump MSRV to 1.88, update `time` crate to 0.3.47 to fix RUSTSEC-2026-0009, see #3581 (@NORMAL-EX)
|
||||||
- Allow home and end keys to be used with builtin pager, see #3651 (@keith-hall)
|
- Allow home and end keys to be used with builtin pager, see #3651 (@keith-hall)
|
||||||
- Builtin syntax mapping: cleanup matcher glob parsing logic #3652 (@cyqsimon)
|
- Builtin syntax mapping: cleanup matcher glob parsing logic #3652 (@cyqsimon)
|
||||||
|
- Statically link the CRT for MSVC builds via Cargo config to avoid runtime DLL dependencies. Closes #3634, see #3692 (@barry3406)
|
||||||
|
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
|
||||||
|
- Add shebang-based detection for Tcl (`tclsh`, `wish`) and Expect (`expect`) scripts, see #3647 (@mvanhorn)
|
||||||
- Change the URL of Zig submodule from GitHub to Codeberg, see #3519 (@sorairolake)
|
- Change the URL of Zig submodule from GitHub to Codeberg, see #3519 (@sorairolake)
|
||||||
- Don't color strings inside CSV files, to make it easier to tell which column they belong to, see #3521 (@keith-hall)
|
- Don't color strings inside CSV files, to make it easier to tell which column they belong to, see #3521 (@keith-hall)
|
||||||
- Add syntax highlighting support for COBOL, see #3584 (@adukhan99)
|
- Add syntax highlighting support for COBOL, see #3584 (@adukhan99)
|
||||||
|
|||||||
Vendored
+1
-1
@@ -90,7 +90,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
|
|||||||
languages)
|
languages)
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
local -a languages
|
local -a languages
|
||||||
languages=( $({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') )
|
languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }')"} )
|
||||||
|
|
||||||
_describe 'language' languages && ret=0
|
_describe 'language' languages && ret=0
|
||||||
;;
|
;;
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
diff --git syntaxes/01_Packages/TCL/Tcl.sublime-syntax syntaxes/01_Packages/TCL/Tcl.sublime-syntax
|
||||||
|
index 1234567..abcdefg 100644
|
||||||
|
--- syntaxes/01_Packages/TCL/Tcl.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/TCL/Tcl.sublime-syntax
|
||||||
|
@@ -3,6 +3,7 @@
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Tcl
|
||||||
|
file_extensions:
|
||||||
|
- tcl
|
||||||
|
+first_line_match: ^\#!.*\b(tclsh|wish|expect)\b
|
||||||
|
scope: source.tcl
|
||||||
|
variables:
|
||||||
+35
-9
@@ -207,7 +207,7 @@ impl<'a> Input<'a> {
|
|||||||
kind: OpenedInputKind::StdIn,
|
kind: OpenedInputKind::StdIn,
|
||||||
description,
|
description,
|
||||||
metadata: self.metadata,
|
metadata: self.metadata,
|
||||||
reader: InputReader::new(stdin),
|
reader: InputReader::try_new(stdin)?,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,14 +236,14 @@ impl<'a> Input<'a> {
|
|||||||
file = input_identifier.into_inner().expect("The file was lost in the clircle::Identifier, this should not have happened...");
|
file = input_identifier.into_inner().expect("The file was lost in the clircle::Identifier, this should not have happened...");
|
||||||
}
|
}
|
||||||
|
|
||||||
InputReader::new(BufReader::new(file))
|
InputReader::try_new(BufReader::new(file))?
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
InputKind::CustomReader(reader) => Ok(OpenedInput {
|
InputKind::CustomReader(reader) => Ok(OpenedInput {
|
||||||
description,
|
description,
|
||||||
kind: OpenedInputKind::CustomReader,
|
kind: OpenedInputKind::CustomReader,
|
||||||
metadata: self.metadata,
|
metadata: self.metadata,
|
||||||
reader: InputReader::new(BufReader::new(reader)),
|
reader: InputReader::try_new(BufReader::new(reader))?,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -257,24 +257,29 @@ pub(crate) struct InputReader<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> InputReader<'a> {
|
impl<'a> InputReader<'a> {
|
||||||
pub(crate) fn new<R: BufRead + 'a>(mut reader: R) -> InputReader<'a> {
|
#[cfg(test)]
|
||||||
|
pub(crate) fn new<R: BufRead + 'a>(reader: R) -> InputReader<'a> {
|
||||||
|
Self::try_new(reader).expect("reading the first line failed")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn try_new<R: BufRead + 'a>(mut reader: R) -> io::Result<InputReader<'a>> {
|
||||||
let mut first_line = vec![];
|
let mut first_line = vec![];
|
||||||
reader.read_until(b'\n', &mut first_line).ok();
|
reader.read_until(b'\n', &mut first_line)?;
|
||||||
|
|
||||||
let content_type = inspect_content_type(&first_line);
|
let content_type = inspect_content_type(&first_line);
|
||||||
|
|
||||||
if content_type == Some(ContentType::UTF_16LE) {
|
if content_type == Some(ContentType::UTF_16LE) {
|
||||||
read_utf16_line(&mut reader, &mut first_line, 0x00, 0x0A).ok();
|
read_utf16_line(&mut reader, &mut first_line, 0x00, 0x0A)?;
|
||||||
} else if content_type == Some(ContentType::UTF_16BE) {
|
} else if content_type == Some(ContentType::UTF_16BE) {
|
||||||
read_utf16_line(&mut reader, &mut first_line, 0x0A, 0x00).ok();
|
read_utf16_line(&mut reader, &mut first_line, 0x0A, 0x00)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputReader {
|
Ok(InputReader {
|
||||||
inner: Box::new(reader),
|
inner: Box::new(reader),
|
||||||
first_line,
|
first_line,
|
||||||
content_type,
|
content_type,
|
||||||
unbuffered: false,
|
unbuffered: false,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn read_line(&mut self, buf: &mut Vec<u8>) -> io::Result<bool> {
|
pub(crate) fn read_line(&mut self, buf: &mut Vec<u8>) -> io::Result<bool> {
|
||||||
@@ -405,6 +410,27 @@ fn non_zip_pk_prefix_is_not_treated_as_binary() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn input_open_returns_initial_read_errors() {
|
||||||
|
struct FailingRead;
|
||||||
|
|
||||||
|
impl Read for FailingRead {
|
||||||
|
fn read(&mut self, _buf: &mut [u8]) -> io::Result<usize> {
|
||||||
|
Err(io::Error::other("initial read failed"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let input = Input::from_reader(Box::new(FailingRead));
|
||||||
|
let result = input.open(io::empty(), None);
|
||||||
|
|
||||||
|
assert!(result.is_err());
|
||||||
|
assert!(result
|
||||||
|
.err()
|
||||||
|
.unwrap()
|
||||||
|
.to_string()
|
||||||
|
.contains("initial read failed"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn utf16le() {
|
fn utf16le() {
|
||||||
let content = b"\xFF\xFE\x73\x00\x0A\x00\x64\x00";
|
let content = b"\xFF\xFE\x73\x00\x0A\x00\x64\x00";
|
||||||
|
|||||||
+2
-2
@@ -155,7 +155,7 @@ impl LessOpenPreprocessor {
|
|||||||
|
|
||||||
Ok(OpenedInput {
|
Ok(OpenedInput {
|
||||||
kind,
|
kind,
|
||||||
reader: InputReader::new(BufReader::new(
|
reader: InputReader::try_new(BufReader::new(
|
||||||
if matches!(self.kind, LessOpenKind::TempFile) {
|
if matches!(self.kind, LessOpenKind::TempFile) {
|
||||||
let lessopen_string = match String::from_utf8(lessopen_stdout) {
|
let lessopen_string = match String::from_utf8(lessopen_stdout) {
|
||||||
Ok(string) => string,
|
Ok(string) => string,
|
||||||
@@ -192,7 +192,7 @@ impl LessOpenPreprocessor {
|
|||||||
.map(|s| s.replacen("%s", &path_str, 1).replacen("%s", "-", 1)),
|
.map(|s| s.replacen("%s", &path_str, 1).replacen("%s", "-", 1)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
)),
|
))?,
|
||||||
metadata: input.metadata,
|
metadata: input.metadata,
|
||||||
description: input.description,
|
description: input.description,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/expect -f
|
||||||
|
set timeout 30
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env tclsh
|
||||||
|
puts "Hello from tclsh"
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/wish
|
||||||
|
button .b -text "Click"
|
||||||
@@ -4202,3 +4202,36 @@ fn plain_without_diff_still_works() {
|
|||||||
.success()
|
.success()
|
||||||
.stdout("line 1\nline 2 modified\nline 3\nline 4 added\n");
|
.stdout("line 1\nline 2 modified\nline 3\nline 4 added\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tcl_shebang_detection_tclsh() {
|
||||||
|
bat()
|
||||||
|
.arg("--color=always")
|
||||||
|
.arg("--style=plain")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.arg("regression_tests/issue_3647_tclsh")
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tcl_shebang_detection_wish() {
|
||||||
|
bat()
|
||||||
|
.arg("--color=always")
|
||||||
|
.arg("--style=plain")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.arg("regression_tests/issue_3647_wish")
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn tcl_shebang_detection_expect() {
|
||||||
|
bat()
|
||||||
|
.arg("--color=always")
|
||||||
|
.arg("--style=plain")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.arg("regression_tests/issue_3647_expect")
|
||||||
|
.assert()
|
||||||
|
.success();
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m!/usr/bin/expect -f[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Expect script detected via expect shebang[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m timeout [0m[38;2;190;132;255m30[0m
|
||||||
|
[38;2;248;248;242mspawn[0m[38;2;248;248;242m ssh user@host[0m
|
||||||
|
[38;2;248;248;242mexpect[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpassword:[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;248;248;242msend[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116msecret[0m[38;2;190;132;255m\r[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;248;248;242mexpect[0m[38;2;248;248;242m [0m[38;2;249;38;114meof[0m
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m!/usr/bin/env tclsh[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Tcl script detected via tclsh shebang[0m
|
||||||
|
[38;2;249;38;114mputs[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mHello from tclsh[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;249;38;114mset[0m[38;2;248;248;242m x [0m[38;2;190;132;255m42[0m
|
||||||
|
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m[38;2;255;255;255m$[0m[38;2;255;255;255mx[0m[38;2;248;248;242m [0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m}[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||||
|
[38;2;248;248;242m [0m[38;2;249;38;114mputs[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpositive[0m[38;2;230;219;116m"[0m
|
||||||
|
[38;2;248;248;242m}[0m
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m!/usr/bin/wish[0m
|
||||||
|
[38;2;117;113;94m#[0m[38;2;117;113;94m Tk script detected via wish shebang[0m
|
||||||
|
[38;2;249;38;114mpackage[0m[38;2;248;248;242m require Tk[0m
|
||||||
|
[38;2;248;248;242mbutton[0m[38;2;248;248;242m .b [0m[38;2;249;38;114m-[0m[38;2;248;248;242mtext [0m[38;2;230;219;116m"[0m[38;2;230;219;116mClick[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;249;38;114m-[0m[38;2;248;248;242mcommand [0m[38;2;248;248;242m{[0m[38;2;249;38;114mputs[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mclicked[0m[38;2;230;219;116m"[0m[38;2;248;248;242m}[0m
|
||||||
|
[38;2;248;248;242mpack[0m[38;2;248;248;242m .b[0m
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/expect -f
|
||||||
|
# Expect script detected via expect shebang
|
||||||
|
set timeout 30
|
||||||
|
spawn ssh user@host
|
||||||
|
expect "password:"
|
||||||
|
send "secret\r"
|
||||||
|
expect eof
|
||||||
+7
@@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env tclsh
|
||||||
|
# Tcl script detected via tclsh shebang
|
||||||
|
puts "Hello from tclsh"
|
||||||
|
set x 42
|
||||||
|
if {$x > 0} {
|
||||||
|
puts "positive"
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/wish
|
||||||
|
# Tk script detected via wish shebang
|
||||||
|
package require Tk
|
||||||
|
button .b -text "Click" -command {puts "clicked"}
|
||||||
|
pack .b
|
||||||
Reference in new issue
Block a user