Skip to content

Commit

Permalink
Sun terminal color fixes.
Browse files Browse the repository at this point in the history
This addresses problems in the color handling found on Sun and illumos
consoles.  The infocmp for these terminals is buggy as well.
  • Loading branch information
gdamore committed Jun 1, 2021
1 parent c43eafe commit 3687c97
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion color.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion terminfo/models.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 21 additions & 4 deletions terminfo/s/sun/term.go
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions terminfo/terminfo.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 3687c97

Please sign in to comment.