mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-19 15:04:50 +02:00
New SGR codes to turn off bold/dim independently
Allows for robust patching of formatting into already formatted text. Without this it is not possible to turn off bold without affecting existing dim and vice versa.
This commit is contained in:
@@ -311,8 +311,8 @@ func (self url_code) is_empty() bool {
|
||||
func (self *sgr_code) update() {
|
||||
p := make([]string, 0, 1)
|
||||
s := make([]string, 0, 1)
|
||||
p, s = self.bold.as_sgr("1", "22", p, s)
|
||||
p, s = self.dim.as_sgr("2", "22", p, s)
|
||||
p, s = self.bold.as_sgr("1", "221", p, s)
|
||||
p, s = self.dim.as_sgr("2", "222", p, s)
|
||||
p, s = self.italic.as_sgr("3", "23", p, s)
|
||||
p, s = self.reverse.as_sgr("7", "27", p, s)
|
||||
p, s = self.strikethrough.as_sgr("9", "29", p, s)
|
||||
|
||||
@@ -33,8 +33,8 @@ func TestANSIStyleSprint(t *testing.T) {
|
||||
}
|
||||
|
||||
test("", "", "")
|
||||
test("bold", "\x1b[1m", "\x1b[22m")
|
||||
test("bold fg=red u=curly", "\x1b[1;4:3;31m", "\x1b[22;4:0;39m")
|
||||
test("bold", "\x1b[1m", "\x1b[221m")
|
||||
test("bold fg=red u=curly", "\x1b[1;4:3;31m", "\x1b[221;4:0;39m")
|
||||
test("fg=123", "\x1b[38:5:123m", "\x1b[39m")
|
||||
test("fg=15", "\x1b[97m", "\x1b[39m")
|
||||
test("bg=15", "\x1b[107m", "\x1b[49m")
|
||||
|
||||
Reference in New Issue
Block a user