diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-17 00:54:02 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-17 01:12:08 +0100 |
commit | 6ec8abb19214835348bb96575455b0a65079741e (patch) | |
tree | db7025ce171d1114d591aca12abb3d03c8d5d42a /src/display | |
parent | 6604bd6dc1fd9ad110fc5ff1f01f3b8b4c787ed8 (diff) | |
download | chawan-6ec8abb19214835348bb96575455b0a65079741e.tar.gz |
layout: use html/body bgcolor as canvas bgcolor
This is required by the standard. (Without this, lots of websites have incorrect background colors, because they set the body height to 100% of the viewport.)
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/term.nim | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/display/term.nim b/src/display/term.nim index cd2df219..a4c91e61 100644 --- a/src/display/term.nim +++ b/src/display/term.nim @@ -164,9 +164,7 @@ proc resetFormat(term: Terminal): string = when termcap_found: if term.isatty(): return term.cap me - return SGR() - else: - return SGR() + return SGR() proc startFormat(term: Terminal, flag: FormatFlags): string = when termcap_found: @@ -473,7 +471,8 @@ proc writeGrid*(term: Terminal, grid: FixedGrid, x = 0, y = 0) = for lx in x ..< x + grid.width: let i = ly * term.canvas.width + lx term.canvas[i] = grid[(ly - y) * grid.width + (lx - x)] - if i >= term.canvas.width and FLAG_OVERLINE in term.canvas[i].format.flags and term.emulateOverline: + let isol = FLAG_OVERLINE in term.canvas[i].format.flags + if i >= term.canvas.width and isol and term.emulateOverline: let w = grid[(ly - y) * grid.width + (lx - x)].width() let s = i - term.canvas.width var j = s @@ -483,7 +482,8 @@ proc writeGrid*(term: Terminal, grid: FixedGrid, x = 0, y = 0) = if cell.str == "": cell.str = " " if cell.str == " ": - cell.format.fgcolor = grid[(ly - y) * grid.width + (lx - x)].format.fgcolor + let i = (ly - y) * grid.width + (lx - x) + cell.format.fgcolor = grid[i].format.fgcolor j += cell[].width() proc applyConfig(term: Terminal) = @@ -520,7 +520,8 @@ proc outputGrid*(term: Terminal) = if term.config.display.force_clear: term.applyConfig() term.outfile.write(term.resetFormat()) - let samesize = term.canvas.width == term.pcanvas.width and term.canvas.height == term.pcanvas.height + let samesize = term.canvas.width == term.pcanvas.width and + term.canvas.height == term.pcanvas.height if term.config.display.force_clear or not term.cleared or not samesize: term.outfile.write(term.generateFullOutput(term.canvas)) term.cleared = true |