aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordam <dam@gudinoff>2023-12-11 01:28:50 +0000
committerdam <dam@gudinoff>2023-12-11 01:28:50 +0000
commit58716ceff7f82ee8b01ea43734cc755cacff25a6 (patch)
tree2c6c7a07e569337196541d26d856dbd37a5fa593
parent1fe3a96afaa781c2b54f89cbeaaca8c101f2452b (diff)
downloadtask-time-tracker-58716ceff7f82ee8b01ea43734cc755cacff25a6.tar.zst
task-time-tracker-58716ceff7f82ee8b01ea43734cc755cacff25a6.zip
Add set_terminal_title procedure.
-rw-r--r--TUI/module.jai13
-rw-r--r--ttt.jai1
2 files changed, 14 insertions, 0 deletions
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!
diff --git a/ttt.jai b/ttt.jai
index 1a25143..49e88eb 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -1257,6 +1257,7 @@ main :: () {
#if 1 {
print("test 4\n", to_standard_error = true);
TUI.start();
+ TUI.set_terminal_title("bazinga");
xcolumns, xrows: int;
key: TUI.Key = #char "d";
last_none_char := "X";