From ba12145728f08c98df439ca47f9209dcbd7d335d Mon Sep 17 00:00:00 2001 From: crc <> Date: Mon, 22 Jan 2024 16:49:17 +0000 Subject: [PATCH] takawiri: use ioctl: to get terminal size; report errors on start if too small FossilOrigin-Name: e6b1567ab2db12c536a596913be21f5fb774209c7e67a395cd54e936dfdc47b4 --- takawiri.retro | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/takawiri.retro b/takawiri.retro index 47d3619..6f99c17 100755 --- a/takawiri.retro +++ b/takawiri.retro @@ -18,14 +18,18 @@ Setup the text output buffer dimensions. #25 'TOB:H const ~~~ -Setup the local terminal dimensions. - -TODO: some systems may provide this in the environment. See if - this can be pulled in automatically if present? +Setup the local terminal dimensions. This requires the current +development build of Retro to gain access to the `ioctl:` words. +(If not using this, hard code the terminal constraints for your +system). ~~~ -#105 'LT:W const -#30 'LT:H const +ioctl:term-size (rows,cols) 'LT:W const 'LT:H const +~~~ + +~~~ +LT:W #100 lt? [ 'Terminal_too_narrow! s:put nl bye ] if +LT:H #27 lt? [ 'Terminal_too_short! s:put nl bye ] if ~~~ # Dependencies