From c7cfb998411e0e4eda1c5277271752edfaa70cda Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Thu, 8 Feb 2024 16:00:16 -0800 Subject: [PATCH] Display correct length for the whole utf8 characters --- src/assets.tal | 4 ++++ src/left.tal | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/assets.tal b/src/assets.tal index 2686723..4c0d20b 100644 --- a/src/assets.tal +++ b/src/assets.tal @@ -39,6 +39,7 @@ 070f 0f0f 0f0f 0f0f 0f0f 0f0f 0f0f 0f07 ] &end [ 80c0 e0f0 f8fc feff fffe fcf8 f0e0 c080 ] + @rune-icns [ 0000 0000 0010 6c82 9282 6c10 0000 0000 0000 0000 0010 7cfe eefe 7c10 0000 0000 @@ -49,6 +50,9 @@ 0000 0000 0010 18fc 7efc 1810 0000 0000 0000 0000 0010 18fc 02fc 1810 0000 0000 ] +@utf8-lengths [ + 04 04 04 04 04 04 04 04 05 05 05 05 06 06 01 01 ] + @font ( cream12 ) 0707 0707 0707 0707 070e 0707 0707 0707 0707 0707 0707 0707 0707 0707 0707 0707 0403 0509 0606 0803 0505 0806 0306 0306 0703 0707 0707 0707 0707 0404 0406 0406 diff --git a/src/left.tal b/src/left.tal index 67edef8..29efbeb 100644 --- a/src/left.tal +++ b/src/left.tal @@ -61,7 +61,7 @@ ( name ) "Left 0a ( details ) "A 20 "Text 20 "Editor 0a ( author ) "By 20 "Hundred 20 "Rabbits 0a - ( date ) "16 20 "Jan 20 "2024 $1 + ( date ) "8 20 "Feb 20 "2024 $1 01 ( > ) 83 =appicon @@ -741,7 +741,7 @@ ( a ) LITr 00 get-scroll-addr &ver ( -- ) EQUkr STHr ?&ver-end - detect-state LDAk #0a NEQ ?{ INCr } + scan-state LDAk #0a NEQ ?{ INCr } next-glyph LDAk ?&ver &ver-end POP2r ( | goto x ) @@ -749,7 +749,7 @@ ( a ) LIT2r 0000 &hor ( -- ) LDAk #0a EQU ?&hor-end - detect-state get-glyph-width STH2 + scan-state get-glyph-width STH2 ADD2r LTH2kr STHr ?&hor-end next-glyph LDAk ?&hor &hor-end POP2r POP2r #0000 .state STZ2 @@ -759,7 +759,7 @@ [ LIT2r 0000 ] get-scroll-addr !& &l ( -- ) - detect-state get-glyph-width STH2 + scan-state get-glyph-width STH2 ADD2r LDAk #0a NEQ ?{ POP2r LIT2r 0000 } next-glyph & GTH2k ?&l POP2 POP2 STH2r JMP2r @@ -792,7 +792,7 @@ &skip ( addr* -- addr* match ) POP2 POP2 #00 JMP2r -@detect-state ( addr* -- addr* ) +@scan-state ( addr* -- addr* ) ( | parentesis match ) [ LIT2 00 -state/match ] STZ LDAk [ LIT 28 ] NEQ ?{ match-parfwd .state/match STZ } @@ -894,9 +894,11 @@ LDAk #20 SUB #00 SWP #40 SFT2 ;font-mono/glyphs ADD2 JMP2r @next-glyph ( addr* -- addr* ) - LDAk #c0 LTH ?{ - LDAk #04 SFT #03 AND INC #00 SWP ADD2 } - INC2 JMP2r + LDAk #c0 LTH ?&1 + LDAk #e0 LTH ?&2 + LDAk #f0 LTH ?&3 + LDAk #f0 SUB #00 SWP ;utf8-lengths ADD2 LDA #00 SWP ADD2 JMP2r + &3 INC2 &2 INC2 &1 INC2 JMP2r ( @|go ) @@ -1178,7 +1180,7 @@ JMP2r @ ( addr* -- addr* ) - detect-state get-glyph-addr .Screen/addr DEO2 + scan-state get-glyph-addr .Screen/addr DEO2 get-color ,&c STR [ LIT2r &anchor $2 ] LITr -Screen/x DEO2kr ( | draw normal )