1
0
mirror of https://github.com/rivo/tview.git synced 2025-04-28 13:48:53 +08:00

Fixed wrong handling of 8-bit ANSI colors. Fixes #317

This commit is contained in:
Oliver 2019-07-11 11:30:32 +01:00
parent fc28d646d0
commit 0e689965bb
2 changed files with 3 additions and 1 deletions

View File

@ -127,6 +127,7 @@ func (a *ansi) Write(text []byte) (int, error) {
"#ffffff", "#ffffff",
}[colorNumber] }[colorNumber]
} }
FieldLoop:
for index, field := range fields { for index, field := range fields {
switch field { switch field {
case "1", "01": case "1", "01":
@ -185,6 +186,7 @@ func (a *ansi) Write(text []byte) (int, error) {
background = color background = color
} }
} }
break FieldLoop
} }
} }
if len(attributes) > 0 || clearAttributes { if len(attributes) > 0 || clearAttributes {

View File

@ -81,7 +81,7 @@ func NewApplication() *Application {
// //
// Note that this also affects the default event handling of the application // Note that this also affects the default event handling of the application
// itself: Such a handler can intercept the Ctrl-C event which closes the // itself: Such a handler can intercept the Ctrl-C event which closes the
// applicatoon. // application.
func (a *Application) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKey) *Application { func (a *Application) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKey) *Application {
a.inputCapture = capture a.inputCapture = capture
return a return a