diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-10 22:50:23 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-10 22:50:23 +0100 |
commit | 940325abfc9714b06de920a2a7f8911eae22f357 (patch) | |
tree | 9651d5f1d22e3eaa6b098b6bbed97a583244375d /src/display | |
parent | 5c267ce6c9c1add997767f5eaad248cdd829c6fc (diff) | |
download | chawan-940325abfc9714b06de920a2a7f8911eae22f357.tar.gz |
Fix blocking socketstream recv/send, clean up ips/serialize & types/color
Write always blocks for now, as it's too big of a footgun not to
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/pager.nim | 2 | ||||
-rw-r--r-- | src/display/term.nim | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/display/pager.nim b/src/display/pager.nim index 3bf330e6..adec0d9e 100644 --- a/src/display/pager.nim +++ b/src/display/pager.nim @@ -183,7 +183,7 @@ proc refreshDisplay(pager: Pager, container = pager.container) = var by = 0 pager.clearDisplay() var hlformat = newFormat() - hlformat.bgcolor = CellColor(rgb: true, rgbcolor: pager.config.hlcolor) + hlformat.bgcolor = pager.config.hlcolor.cellColor() for line in container.ilines(container.fromy ..< min(container.fromy + pager.display.height, container.numLines)): var w = 0 # width of the row so far var i = 0 # byte in line.str diff --git a/src/display/term.nim b/src/display/term.nim index fcb76692..4a166c90 100644 --- a/src/display/term.nim +++ b/src/display/term.nim @@ -192,13 +192,13 @@ proc distance(a, b: CellColor): float = proc invert(color: CellColor, bg: bool): CellColor = if color == defaultColor: if bg: - return CellColor(rgb: true, rgbcolor: ColorsRGB["white"]) + return ColorsRGB["white"].cellColor() else: - return CellColor(rgb: true, rgbcolor: ColorsRGB["black"]) + return ColorsRGB["black"].cellColor() elif color.rgb: - return CellColor(rgb: true, rgbcolor: RGBColor(0xFFFFFF - uint32(color.rgbcolor))) + return RGBColor(0xFFFFFF - cast[uint32](color.rgbcolor)).cellColor() else: - return CellColor(rgb: true, rgbcolor: RGBColor(0xFFFFFF - uint32(ANSIColorMap[color.color mod 10]))) + return RGBColor(0xFFFFFF - uint32(ANSIColorMap[color.color mod 10])).cellColor() # Use euclidian distance to quantize RGB colors. proc approximateANSIColor(rgb: RGBColor, exclude = -1): int = |