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
commit e237428d42

View file

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