diff options
Diffstat (limited to '')
-rw-r--r-- | examples/terminalsize.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/terminalsize.lua b/examples/terminalsize.lua index ed66792..105a415 100644 --- a/examples/terminalsize.lua +++ b/examples/terminalsize.lua | |||
@@ -24,13 +24,13 @@ local function cursor_move_horiz(n) | |||
24 | end | 24 | end |
25 | 25 | ||
26 | 26 | ||
27 | local w, h | 27 | local rows, cols |
28 | print("Change the terminal window size, press any key to exit") | 28 | print("Change the terminal window size, press any key to exit") |
29 | while not sys.readansi(0.2) do -- use readansi to not leave stray bytes in the input buffer | 29 | while not sys.readansi(0.2) do -- use readansi to not leave stray bytes in the input buffer |
30 | local nw, nh = sys.termsize() | 30 | local nrows, ncols = sys.termsize() |
31 | if w ~= nw or h ~= nh then | 31 | if rows ~= nrows or cols ~= ncols then |
32 | w, h = nw, nh | 32 | rows, cols = nrows, ncols |
33 | local text = "Terminal size: " .. w .. "x" .. h .. " " | 33 | local text = "Terminal size: " .. rows .. "x" .. cols .. " " |
34 | io.write(text .. cursor_move_horiz(-#text)) | 34 | io.write(text .. cursor_move_horiz(-#text)) |
35 | io.flush() | 35 | io.flush() |
36 | end | 36 | end |