diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/io/term.nim | 6 | ||||
-rw-r--r-- | src/layout/engine.nim | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/io/term.nim b/src/io/term.nim index dc54a34c..a51b2a56 100644 --- a/src/io/term.nim +++ b/src/io/term.nim @@ -8,6 +8,8 @@ type height*: int ppc*: int ppl*: int + width_px*: int + height_px*: int proc getTermAttributes*(): TermAttributes = if stdin.isatty(): @@ -16,6 +18,8 @@ proc getTermAttributes*(): TermAttributes = if ioctl(cint(getOsFileHandle(stdout)), TIOCGWINSZ, addr win) != -1: result.width = int(win.ws_col) result.height = int(win.ws_row) + result.width_px = int(win.ws_xpixel) + result.height_px = int(win.ws_ypixel) result.ppc = int(win.ws_xpixel) div int(win.ws_col) result.ppl = int(win.ws_ypixel) div int(win.ws_row) return @@ -26,3 +30,5 @@ proc getTermAttributes*(): TermAttributes = result.height = 24 result.ppc = 9 result.ppl = 18 + result.width_px = result.ppc * result.width + result.height_px = result.ppl * result.height diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 25da94b2..b96f11fa 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -9,7 +9,7 @@ import utils/twtstr import io/term func cells_in(l: CSSLength, state: LayoutState, d: int, p: Option[int], o: bool): int = - return cells(l, d, state.term.width, state.term.height, p, o) + return cells(l, d, state.term.width_px, state.term.height_px, p, o) func cells_w(l: CSSLength, state: LayoutState, p: int): int = return l.cells_in(state, state.term.ppc, p.some, true) |