Fix dynamic terminfo when an alias is used (#639)

Co-authored-by: Garrett D'Amore <garrett@damore.org>
This commit is contained in:
Tim Culverhouse 2023-12-03 17:40:31 -06:00 committed by GitHub
parent 2917c3801e
commit 20b65d615f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 7 deletions

View File

@ -185,16 +185,10 @@ func (tc *termcap) setupterm(name string) error {
func LoadTerminfo(name string) (*terminfo.Terminfo, string, error) { func LoadTerminfo(name string) (*terminfo.Terminfo, string, error) {
var tc termcap var tc termcap
if err := tc.setupterm(name); err != nil { if err := tc.setupterm(name); err != nil {
if err != nil { return nil, "", err
return nil, "", err
}
} }
t := &terminfo.Terminfo{} t := &terminfo.Terminfo{}
// If this is an alias record, then just emit the alias
t.Name = tc.name t.Name = tc.name
if t.Name != name {
return t, "", nil
}
t.Aliases = tc.aliases t.Aliases = tc.aliases
t.Colors = tc.getnum("colors") t.Colors = tc.getnum("colors")
t.Columns = tc.getnum("cols") t.Columns = tc.getnum("cols")