about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-02-17 13:29:15 +0100
committerbptato <nincsnevem662@gmail.com>2024-02-17 13:30:15 +0100
commit3fe649010975686e9072678e4a4aafef6e4241fc (patch)
treea9a5eeaf5338eaba60e658240599faf6b7121588
parent4e264e9d75844382e81bd8315671ca7e2f7bade3 (diff)
downloadchawan-3fe649010975686e9072678e4a4aafef6e4241fc.tar.gz
winattrs: remove unnecessary call, fix height_px fallback
no need for every new buffer to query the window size
-rw-r--r--src/display/winattrs.nim2
-rw-r--r--src/local/container.nim5
-rw-r--r--src/local/pager.nim5
3 files changed, 6 insertions, 6 deletions
diff --git a/src/display/winattrs.nim b/src/display/winattrs.nim
index 06666263..1fe07080 100644
--- a/src/display/winattrs.nim
+++ b/src/display/winattrs.nim
@@ -54,5 +54,5 @@ proc getWindowAttributes*(tty: File): WindowAttributes =
     ppc: ppc,
     ppl: ppl,
     width_px: ppc * width,
-    height_px: ppl * width
+    height_px: ppl * height
   )
diff --git a/src/local/container.nim b/src/local/container.nim
index 69bad5be..f57690ce 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -134,9 +134,8 @@ jsDestructor(Highlight)
 jsDestructor(Container)
 
 proc newBuffer*(forkserver: ForkServer, config: BufferConfig,
-    source: BufferSource, title = "", redirectdepth = 0,
-    canreinterpret = true, fd = FileHandle(-1)): Container =
-  let attrs = getWindowAttributes(stdout)
+    source: BufferSource, attrs: WindowAttributes, title = "",
+    redirectdepth = 0, canreinterpret = true, fd = FileHandle(-1)): Container =
   let (process, loaderPid) = forkserver.forkBuffer(source, config, attrs)
   if fd != -1:
     loaderPid.passFd(source.request.url.host, fd)
diff --git a/src/local/pager.nim b/src/local/pager.nim
index eb6e531d..ac241d73 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -448,12 +448,13 @@ proc addContainer*(pager: Pager, container: Container) =
   pager.setContainer(container)
 
 proc newBuffer(pager: Pager, bufferConfig: BufferConfig, source: BufferSource,
-    title = "", redirectdepth = 0, canreinterpret = true,
-    fd = FileHandle(-1)): Container =
+    title = "", redirectdepth = 0, canreinterpret = true, fd = FileHandle(-1)):
+    Container =
   return newBuffer(
     pager.forkserver,
     bufferConfig,
     source,
+    pager.attrs,
     title,
     redirectdepth,
     canreinterpret,