From 58716ceff7f82ee8b01ea43734cc755cacff25a6 Mon Sep 17 00:00:00 2001 From: dam Date: Mon, 11 Dec 2023 01:28:50 +0000 Subject: Add set_terminal_title procedure. --- TUI/module.jai | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'TUI') diff --git a/TUI/module.jai b/TUI/module.jai index c8a5512..044fd65 100644 --- a/TUI/module.jai +++ b/TUI/module.jai @@ -43,6 +43,10 @@ Commands :: struct { ClearScreen :: "\e[2J"; ClearLine :: "\e[2K"; + Bell :: "\x07"; + + SetWindowTitle :: "\e]0;%\x07"; + RefreshWindow :: "\e[7t"; // TODO Not yet tested. SetUTF8 :: "\e%G"; // TODO TEST ME PLEASE @@ -99,6 +103,10 @@ input_override : Key; row := 5; +assert_is_initialized :: inline () { + assert(initialized, "TUI is not ready."); +} + set_next_key :: (key: Key) { input_override = key; } @@ -392,6 +400,11 @@ get_cursor_position :: () -> row: int, column: int { return row, column; } +set_terminal_title :: (title: string) { + assert_is_initialized(); + print(Commands.SetWindowTitle, title); +} + #if OS == .WINDOWS { // Prototyping zone... keep clear! -- cgit v1.2.3