mirror of
https://github.com/sharkdp/bat
synced 2026-06-09 10:03:18 +00:00
Only strip overstrike when a syntax highlighting theme is used
This commit is contained in:
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
GIT-COMMIT(1) Git Manual GIT-COMMIT(1)
|
||||
|
||||
NNAAMMEE
|
||||
git-commit - Record changes to the repository
|
||||
|
||||
SSYYNNOOPPSSIISS
|
||||
ggiitt ccoommmmiitt [--aa | ----iinntteerraaccttiivvee | ----ppaattcchh] [--ss] [--vv] [--uu[_<_m_o_d_e_>]] [----aammeenndd]
|
||||
[----ddrryy--rruunn] [(--cc | --CC | ----ssqquuaasshh) _<_c_o_m_m_i_t_> | ----ffiixxuupp [(aammeenndd|rreewwoorrdd)::]_<_c_o_m_m_i_t_>]
|
||||
[--FF _<_f_i_l_e_> | --mm _<_m_s_g_>] [----rreesseett--aauutthhoorr] [----aallllooww--eemmppttyy]
|
||||
[----aallllooww--eemmppttyy--mmeessssaaggee] [----nnoo--vveerriiffyy] [--ee] [----aauutthhoorr==_<_a_u_t_h_o_r_>]
|
||||
[----ddaattee==_<_d_a_t_e_>] [----cclleeaannuupp==_<_m_o_d_e_>] [----[nnoo--]ssttaattuuss]
|
||||
[--ii | --oo] [----ppaatthhssppeecc--ffrroomm--ffiillee==_<_f_i_l_e_> [----ppaatthhssppeecc--ffiillee--nnuull]]
|
||||
[(----ttrraaiilleerr _<_t_o_k_e_n_>[(==|::)_<_v_a_l_u_e_>])...] [--SS[_<_k_e_y_i_d_>]]
|
||||
[----] [_<_p_a_t_h_s_p_e_c_>...]
|
||||
|
||||
DDEESSCCRRIIPPTTIIOONN
|
||||
Create a new commit containing the current contents of the index and
|
||||
the given log message describing the changes. The new commit is a
|
||||
direct child of HEAD, usually the tip of the current branch, and the
|
||||
branch is updated to point to it (unless no branch is associated with
|
||||
the working tree, in which case HHEEAADD is "detached" as described in ggiitt--
|
||||
cchheecckkoouutt(1)).
|
||||
|
||||
The content to be committed can be specified in several ways:
|
||||
|
||||
1. by using ggiitt--aadddd(1) to incrementally "add" changes to the index
|
||||
before using the ccoommmmiitt command (Note: even modified files must be
|
||||
"added");
|
||||
|
||||
2. by using ggiitt--rrmm(1) to remove files from the working tree and the
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
BBold tteexxtt and _u_n_d_e_r_l_i_n_e
|
||||
@@ -2541,6 +2541,46 @@ fn binary_as_text() {
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_strip_overstrike_for_plain_text() {
|
||||
// Overstrike is preserved for plain text files (no syntax highlighting)
|
||||
bat()
|
||||
.arg("--color=never")
|
||||
.arg("--decorations=never")
|
||||
.arg("overstrike.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("B\x08Bold t\x08te\x08ex\x08xt\x08t and _\x08u_\x08n_\x08d_\x08e_\x08r_\x08l_\x08i_\x08n_\x08e\n")
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strip_overstrike_with_syntax_highlighting() {
|
||||
// Overstrike is stripped when syntax highlighting is applied (e.g., for help)
|
||||
bat()
|
||||
.arg("--force-colorization")
|
||||
.arg("--language=help")
|
||||
.arg("overstrike.txt")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("Bold text and underline"))
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn strip_overstrike_for_manpage_syntax() {
|
||||
// Overstrike is stripped for .man files (Manpage syntax)
|
||||
bat()
|
||||
.arg("--force-colorization")
|
||||
.arg("git-commit.man")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout(predicate::str::contains("NAME"))
|
||||
.stdout(predicate::str::contains("git-commit - Record changes"))
|
||||
.stdout(predicate::str::is_match(r"\x1b\[38;[0-9;]+m--interactive\x1b\[").unwrap())
|
||||
.stderr("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_paging_arg() {
|
||||
bat()
|
||||
|
||||
Reference in New Issue
Block a user