Fix bright option (#7622)

Setting the option to true, then to false would not turn off bright attribute.
This commit is contained in:
WhiteDuke
2018-04-18 23:29:10 +02:00
committed by Andreas Rumpf
parent 4a9f6f00ad
commit e237428d42

View File

@@ -557,8 +557,8 @@ proc setForegroundColor*(f: File, fg: ForegroundColor, bright=false) =
when defined(windows):
let h = conHandle(f)
var old = getAttributes(h) and not FOREGROUND_RGB
if bright:
old = old or FOREGROUND_INTENSITY
old = if bright: old or FOREGROUND_INTENSITY
else: old and not(FOREGROUND_INTENSITY)
const lookup: array[ForegroundColor, int] = [
0,
(FOREGROUND_RED),
@@ -579,8 +579,8 @@ proc setBackgroundColor*(f: File, bg: BackgroundColor, bright=false) =
when defined(windows):
let h = conHandle(f)
var old = getAttributes(h) and not BACKGROUND_RGB
if bright:
old = old or BACKGROUND_INTENSITY
old = if bright: old or BACKGROUND_INTENSITY
else: old and not(BACKGROUND_INTENSITY)
const lookup: array[BackgroundColor, int] = [
0,
(BACKGROUND_RED),