1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-09 09:22:48 +03:00

bump tcell

This commit is contained in:
Jesse Duffield
2021-06-05 22:17:49 +10:00
parent fb395bca6e
commit 82022615dd
183 changed files with 7624 additions and 13146 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2020 The TCell Authors
// Copyright 2021 The TCell Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
@@ -217,7 +217,9 @@ type Terminfo struct {
PasteStart string
PasteEnd string
Modifiers int
TrueColor bool // true if the terminal supports direct color
InsertChar string // string to insert a character (ich1)
AutoMargin bool // true if writing to last cell in line advances
TrueColor bool // true if the terminal supports direct color
}
const (
@@ -742,6 +744,7 @@ func LookupTerminfo(name string) (*Terminfo, error) {
}
addtruecolor := false
add256color := false
switch os.Getenv("COLORTERM") {
case "truecolor", "24bit", "24-bit":
addtruecolor = true
@@ -771,6 +774,21 @@ func LookupTerminfo(name string) (*Terminfo, error) {
}
}
// If the name ends in -256color, maybe fabricate using the xterm 256 color sequences
if t == nil && strings.HasSuffix(name, "-256color") {
suffixes := []string{
"-88color",
"-color",
}
base := name[:len(name)-len("-256color")]
for _, s := range suffixes {
if t, _ = LookupTerminfo(base + s); t != nil {
add256color = true
break
}
}
}
if t == nil {
return nil, ErrTermNotFound
}
@@ -798,5 +816,12 @@ func LookupTerminfo(name string) (*Terminfo, error) {
"48;2;%p4%d;%p5%d;%p6%dm"
}
if add256color {
t.Colors = 256
t.SetFg = "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m"
t.SetBg = "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m"
t.SetFgBg = "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m"
t.ResetFgBg = "\x1b[39;49m"
}
return t, nil
}