From ee1a68abb41ec7d0f76b458b5340d08a3f881a2b Mon Sep 17 00:00:00 2001 From: dam Date: Fri, 15 Sep 2023 02:24:05 +0100 Subject: Added QueryWindowSizeInChars to tui.jai. --- tui.jai | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'tui.jai') diff --git a/tui.jai b/tui.jai index a0eb025..3c868ee 100644 --- a/tui.jai +++ b/tui.jai @@ -12,6 +12,16 @@ Drawings :: struct { TeeB :: "\x76"; TeeT :: "\x77"; LineV :: "\x78"; + + Blank :: "\x5F"; + Diamond :: "\x60"; + Checkerboard :: "\x61"; + PlusMinus :: "\x67"; + LessThanOrEqual :: "\x79"; + GreaterThanOrEqual :: "\x7A"; + Pi :: "\x7B"; + NotEqual :: "\x7C"; + CenteredDot :: "\x7E"; } Commands :: struct { @@ -21,6 +31,11 @@ Commands :: struct { EnterDrawingMode :: "\e(0"; EnterNormalMode :: "\e(B"; ClearScreen :: "\e[2J"; + ClearLine :: "\e[2K"; + + RefreshWindow :: "\e[7t"; // TODO Not yet tested. + + SetUTF8 :: "\e%G"; // TODO TEST ME PLEASE // Cursor Visibility ShowCursor :: "\e[?25h"; @@ -44,21 +59,22 @@ Commands :: struct { CursorNormalMode :: "\e[?1l"; // Query State - QueryCursorPos :: "\e[6n"; // Emits the cursor position as: ESC [ ; R Where = row and = column. + QueryCursorPosition :: "\e[6n"; // Emits the cursor position as: "ESC [ ; R" Where = row and = column. QueryDeviceAttributes :: "\e[0c"; + QueryWindowSizeInChars :: "\e[18t"; // Emits the window size as: "ESC [ 8 ; t" Where = row and = column. + } start :: () { - write_string(Commands.EnterAlternateBuffer); + write_strings(Commands.EnterAlternateBuffer, Commands.SetUTF8, Commands.HideCursor); } stop :: () { - write_string(Commands.EnterMainBuffer); + write_strings(Commands.EnterMainBuffer, Commands.ShowCursor); } draw_box :: (x: int, y: int, width: int, height: int, to_standard_error := false) { - write_string(Commands.HideCursor); write_strings( // Commands.EnterNormalMode, Commands.EnterDrawingMode, -- cgit v1.2.3