about summary refs log tree commit diff stats
path: root/src/io
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-01-23 14:20:34 +0100
committerbptato <nincsnevem662@gmail.com>2022-01-23 14:20:34 +0100
commitfb1d193045a6e1144e33711646c9b1d49e2781af (patch)
tree204d6a2e7b0ddaba6e972a6900f338fe7c523e96 /src/io
parentd97776fb627720bc4bd5841ffffcd8c9af712f3c (diff)
downloadchawan-fb1d193045a6e1144e33711646c9b1d49e2781af.tar.gz
Fix incorrect canvas width and whitespace bugs
Diffstat (limited to 'src/io')
-rw-r--r--src/io/term.nim5
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