From 3687c97d3dde835dd6efbbd917f9a230f2a90674 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 31 May 2021 17:59:55 -0700 Subject: [PATCH] Sun terminal color fixes. This addresses problems in the color handling found on Sun and illumos consoles. The infocmp for these terminals is buggy as well. --- color.go | 2 +- terminfo/models.txt | 1 - terminfo/s/sun/term.go | 25 +++++++++++++++++++++---- terminfo/terminfo.go | 3 +-- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/color.go b/color.go index 97c0c2a2..8e50fa30 100644 --- a/color.go +++ b/color.go @@ -38,7 +38,7 @@ const ( // system or terminal default may exist. It's also the zero value. ColorDefault Color = 0 - // ColorIsValid is used to indicate the color value is actually + // ColorValid is used to indicate the color value is actually // valid (initialized). This is useful to permit the zero value // to be treated as the default. ColorValid Color = 1 << 32 diff --git a/terminfo/models.txt b/terminfo/models.txt index 60905e02..f0db8129 100644 --- a/terminfo/models.txt +++ b/terminfo/models.txt @@ -14,7 +14,6 @@ pcansi rxvt,rxvt-256color,rxvt-88color,rxvt-unicode,rxvt-unicode-256color screen,screen-256color st,st-256color|simpleterm -sun,sun-color termite tmux vt52 diff --git a/terminfo/s/sun/term.go b/terminfo/s/sun/term.go index 9aa29850..7913ec7f 100644 --- a/terminfo/s/sun/term.go +++ b/terminfo/s/sun/term.go @@ -1,4 +1,22 @@ -// Generated automatically. DO NOT HAND-EDIT. +// 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. +// You may obtain a copy of the license at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// This terminal definition is hand-coded, as the default terminfo for +// this terminal is busted with respect to color. Unlike pretty much every +// other ANSI compliant terminal, this terminal cannot combine foreground and +// background escapes. The default terminfo also only provides escapes for +// 16-bit color. package sun @@ -58,9 +76,8 @@ func init() { AttrOff: "\x1b[m", Bold: "\x1b[1m", Reverse: "\x1b[7m", - SetFg: "\x1b[3%p1%dm", - SetBg: "\x1b[4%p1%dm", - SetFgBg: "\x1b[3%p1%d;4%p2%dm", + SetFg: "\x1b[38;5;%p1%dm", + SetBg: "\x1b[48;5;%p1%dm", ResetFgBg: "\x1b[0m", PadChar: "\x00", SetCursor: "\x1b[%i%p1%d;%p2%dH", diff --git a/terminfo/terminfo.go b/terminfo/terminfo.go index c2aa3488..7e17352c 100644 --- a/terminfo/terminfo.go +++ b/terminfo/terminfo.go @@ -1,5 +1,4 @@ -// Copyright 2020 The TCell Authors -// 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.