diff options
author | bptato <nincsnevem662@gmail.com> | 2022-01-23 14:20:34 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-01-23 14:20:34 +0100 |
commit | fb1d193045a6e1144e33711646c9b1d49e2781af (patch) | |
tree | 204d6a2e7b0ddaba6e972a6900f338fe7c523e96 /src/io | |
parent | d97776fb627720bc4bd5841ffffcd8c9af712f3c (diff) | |
download | chawan-fb1d193045a6e1144e33711646c9b1d49e2781af.tar.gz |
Fix incorrect canvas width and whitespace bugs
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/term.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/io/term.nim b/src/io/term.nim index 838ba77a..8424ee10 100644 --- a/src/io/term.nim +++ b/src/io/term.nim @@ -19,10 +19,11 @@ proc getTermAttributes*(): TermAttributes = if ioctl(cint(getOsFileHandle(stdout)), TIOCGWINSZ, addr win) != -1: result.ppc = int(win.ws_xpixel) div int(win.ws_col) result.ppl = int(win.ws_ypixel) div int(win.ws_row) + # some terminals don't like it when we fill the last cell. #TODO make this optional result.width = int(win.ws_col) - 1 result.height = int(win.ws_row) - result.width_px = int(win.ws_xpixel) - result.ppc - result.height_px = int(win.ws_ypixel) + result.width_px = result.width * result.ppc + result.height_px = result.height * result.ppl result.cell_ratio = result.ppl / result.ppc return #fail |