diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-07 20:45:54 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-07 20:45:54 +0100 |
commit | debc51f0e4774974b3c04e27dae88444348471bb (patch) | |
tree | a2675185ea10f0b9a475a0690d920c9841a2ae16 /src/display | |
parent | ffdd785de6141b8b779e5c958215ec34962f7726 (diff) | |
download | chawan-debc51f0e4774974b3c04e27dae88444348471bb.tar.gz |
Fix overline emulation in middle of line
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/term.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/display/term.nim b/src/display/term.nim index beb84a4c..fcb76692 100644 --- a/src/display/term.nim +++ b/src/display/term.nim @@ -292,10 +292,15 @@ func generateFullOutput(term: Terminal, grid: FixedGrid): string = result &= term.cursorGoto(0, 0) result &= term.resetFormat() for y in 0 ..< grid.height: + var w = 0 for x in 0 ..< grid.width: + while w < x: + result &= " " + inc w let cell = grid[y * grid.width + x] result &= term.processFormat(format, cell.format) result &= cell.str + w += cell.width() result &= term.clearEnd() if y != grid.height - 1: result &= "\r\n" @@ -303,9 +308,13 @@ func generateFullOutput(term: Terminal, grid: FixedGrid): string = func generateSwapOutput(term: Terminal, grid: FixedGrid, prev: FixedGrid): string = var format = newFormat() var x = 0 + var w = 0 var line = "" var lr = false for i in 0 ..< grid.cells.len: + while w < x: + line &= " " + inc w if x >= grid.width: format = newFormat() if lr: @@ -315,10 +324,12 @@ func generateSwapOutput(term: Terminal, grid: FixedGrid, prev: FixedGrid): strin result &= line lr = false x = 0 + w = 0 line = "" lr = lr or (grid[i] != prev[i]) line &= term.processFormat(format, grid.cells[i].format) line &= grid.cells[i].str + w += grid.cells[i].width() inc x if lr: result &= term.cursorGoto(0, grid.height - 1) |