diff options
| author | dam <dam@gudinoff> | 2024-02-22 00:42:50 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2024-02-22 00:42:50 +0000 |
| commit | 6a28cf6fb30f96d540b3ecbfd53b9e20ef61869d (patch) | |
| tree | 5e2e74bb06fba95152f30a2844e71da796a0bf3f | |
| parent | 039a248c8d1058c50054008495c77798a358f3d0 (diff) | |
| download | task-time-tracker-6a28cf6fb30f96d540b3ecbfd53b9e20ef61869d.tar.zst task-time-tracker-6a28cf6fb30f96d540b3ecbfd53b9e20ef61869d.zip | |
Added TODO to solve incoherent function key codes.
| -rw-r--r-- | TUI/module.jai | 53 | ||||
| -rw-r--r-- | ttt.jai | 11 |
2 files changed, 44 insertions, 20 deletions
diff --git a/TUI/module.jai b/TUI/module.jai index 2813c17..c8fff63 100644 --- a/TUI/module.jai +++ b/TUI/module.jai @@ -14,38 +14,39 @@ #import "String"; #import "Thread"; +// Special Graphics Characters Drawings :: struct { - /* - TODO - Using unicode allows to just-print instead of jumping back and forth between drawing/text modes. - But it seems that not all terminals support unicode?! Do we even bother with those terminals?! - */ - // test_drawing_without_mode :: () { - // top := "┌───┐"; - // btm := "└───┘"; - // print(">%<\n", top); - // print(">%<\n", btm); - // } + Blank :: "\x5F"; + Diamond :: "\x60"; + Checkerboard :: "\x61"; + HorizontalTab :: "\x62"; + FormFeed :: "\x63"; + CarriageReturn :: "\x64"; + LineFeed :: "\x65"; + DegreeSymbol :: "\x66"; + PlusMinus :: "\x67"; + NewLine :: "\x68"; + VerticalTab :: "\x69"; CornerBR :: "\x6A"; CornerTR :: "\x6B"; CornerTL :: "\x6C"; CornerBL :: "\x6D"; Cross :: "\x6E"; + LineHT :: "\x6F"; + LineHt :: "\x70"; LineH :: "\x71"; + LineHb :: "\x72"; + LineHB :: "\x73"; TeeL :: "\x74"; TeeR :: "\x75"; TeeB :: "\x76"; TeeT :: "\x77"; LineV :: "\x78"; - - Blank :: "\x5F"; - Diamond :: "\x60"; - Checkerboard :: "\x61"; - PlusMinus :: "\x67"; LessThanOrEqual :: "\x79"; GreaterThanOrEqual :: "\x7A"; Pi :: "\x7B"; NotEqual :: "\x7C"; + PoundSign :: "\x7D"; CenteredDot :: "\x7E"; } @@ -225,6 +226,26 @@ Keys :: struct #type_info_none { PgUp : Key : #run to_key("\e[5~"); PgDown : Key : #run to_key("\e[6~"); + /* TODO On get_key, convert F1 to F4 into the format "\e[1X~" + so that: + F1 : 1b 4f 50 : ^OP : -> \e[11~ + Shift+ F1 : 1b 4f 32 50 : ^O2P : -> \e[11;2~ + F2 : 1b 4f 51 : ^OQ : -> \e[12~ + Shift+ F2 : 1b 4f 32 51 : ^O2Q : -> \e[12;2~ + F3 : 1b 4f 52 : ^OR : -> \e[13~ + Shift+ F3 : 1b 4f 32 52 : ^O2R : -> \e[13;2~ + F4 : 1b 4f 53 : ^OS : -> \e[14~ + Meta+ Fx : 1b 4f 31 53 : ^O1S : -> \e[14;1~ + Shift+ F4 : 1b 4f 32 53 : ^O2S : -> \e[14;2~ + Alt+ F4 : 1b 4f 33 53 : ^O3S : -> \e[14;3~ + S+A F4 : 1b 4f 34 53 : ^O4S : -> \e[14;4~ + Ctrl+ F4 : 1b 4f 35 53 : ^O4S : -> \e[14;5~ + Ctrl+ F4 : 1b 4f 35 53 : ^O4S : -> \e[14;5~ + ... + */ + + WIP HERE + F1 : Key : #run to_key("\eOP"); F2 : Key : #run to_key("\eOQ"); F3 : Key : #run to_key("\eOR"); @@ -1358,17 +1358,20 @@ main :: () { case; { TUI.set_cursor_position(3+drop_down, 2); str := TUI.to_string(key); + array_to_print: [..] string; for 0..str.count-1 { - print("'%'", FormatInt.{value = cast(u8)str[it], base=16}); + tmp := tprint("%", FormatInt.{value = cast(u8)str[it], base=16},, temporary_allocator); + array_add(*array_to_print, tmp); } - write_string(":> "); + string_to_print := join(..array_to_print, separator = " "); + print(": % : ", string_to_print); for 0..str.count-1 { if str[it] == #char "\e" { - str[it] = #char "?"; + str[it] = #char "^"; } } write_string(str); - write_string(" <EOL"); + write_string(" : ~DAM"); drop_down += 1; } } |
