Skip to content

Commit f1b5a0e

Browse files
authored
Merge pull request #51 from zetamatta/fork2
Fix: on Windows 8.1, ESC[7m (REVERSE) does not work.
2 parents c10454b + ce7c9ec commit f1b5a0e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

colorable_windows.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const (
2727
backgroundRed = 0x40
2828
backgroundIntensity = 0x80
2929
backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
30-
commonLvbReverse = 0x4000
3130
commonLvbUnderscore = 0x8000
3231

3332
cENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4
@@ -689,14 +688,15 @@ loop:
689688
attr |= commonLvbUnderscore
690689
case (1 <= n && n <= 3) || n == 5:
691690
attr |= foregroundIntensity
692-
case n == 7:
693-
attr |= commonLvbReverse
691+
case n == 7 || n == 27:
692+
attr =
693+
(attr &^ (foregroundMask | backgroundMask)) |
694+
((attr & foregroundMask) << 4) |
695+
((attr & backgroundMask) >> 4)
694696
case n == 22:
695697
attr &^= foregroundIntensity
696698
case n == 24:
697699
attr &^= commonLvbUnderscore
698-
case n == 27:
699-
attr &^= commonLvbReverse
700700
case 30 <= n && n <= 37:
701701
attr &= backgroundMask
702702
if (n-30)&1 != 0 {

0 commit comments

Comments
 (0)