mirror of
https://github.com/gdamore/tcell.git
synced 2025-04-24 13:48:51 +08:00
fixes #12 Windows reverse video broken
This commit is contained in:
parent
feab7e00ed
commit
9a601da6e4
@ -586,8 +586,17 @@ func mapStyle(style Style) uint16 {
|
|||||||
if b == ColorDefault {
|
if b == ColorDefault {
|
||||||
b = ColorBlack
|
b = ColorBlack
|
||||||
}
|
}
|
||||||
attr := mapColor2RGB(f)
|
var attr uint16
|
||||||
attr |= (mapColor2RGB(b) << 4)
|
// We simulate reverse by doing the color swap ourselves.
|
||||||
|
// Apparently windows cannot really do this except in DBCS
|
||||||
|
// views.
|
||||||
|
if a&AttrReverse != 0 {
|
||||||
|
attr = mapColor2RGB(b)
|
||||||
|
attr |= (mapColor2RGB(f) << 4)
|
||||||
|
} else {
|
||||||
|
attr = mapColor2RGB(f)
|
||||||
|
attr |= (mapColor2RGB(b) << 4)
|
||||||
|
}
|
||||||
if a&AttrBold != 0 {
|
if a&AttrBold != 0 {
|
||||||
attr |= 0x8
|
attr |= 0x8
|
||||||
}
|
}
|
||||||
@ -595,11 +604,9 @@ func mapStyle(style Style) uint16 {
|
|||||||
attr &^= 0x8
|
attr &^= 0x8
|
||||||
}
|
}
|
||||||
if a&AttrUnderline != 0 {
|
if a&AttrUnderline != 0 {
|
||||||
|
// Best effort -- doesn't seem to work though.
|
||||||
attr |= 0x8000
|
attr |= 0x8000
|
||||||
}
|
}
|
||||||
if a&AttrReverse != 0 {
|
|
||||||
attr |= 0x4000
|
|
||||||
}
|
|
||||||
// Blink is unsupported
|
// Blink is unsupported
|
||||||
return attr
|
return attr
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user