From 6134b9d35421d1f04a2a0b64cd070b7dcf52d9d7 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 26 Apr 2023 16:12:50 -0700 Subject: [PATCH] Handle tabs --- gui/notepad/notepad.tal | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/gui/notepad/notepad.tal b/gui/notepad/notepad.tal index 9c83797..6f35dfb 100644 --- a/gui/notepad/notepad.tal +++ b/gui/notepad/notepad.tal @@ -293,18 +293,24 @@ JMP2r #0018 .Screen/y DEO2 ;mem &while - LDAk #0a NEQ ?&no-lb - draw-linebreak - INC2 LDAk walk-on AND ?&while JMP2r - &no-lb ( wrap ) - LDAk #20 NEQ ?&no-wrap + LDAk #20 GTH ?&no-wrap DUP2 word-length .Screen/x DEI2 ADD2 #00d0 LTH2 ?&no-wrap draw-linebreak INC2 LDAk walk-on AND ?&while JMP2r &no-wrap LDAk #20 SUB #00 SWP ;font ADD2 LDA #00 SWP .Screen/x DEI2 ADD2 .Screen/x DEO2 + ( tab ) + LDAk #09 NEQ ?&no-tab + draw-tab + INC2 LDAk walk-on AND ?&while JMP2r + &no-tab + ( linebreak ) + LDAk #0a NEQ ?&no-lb + draw-linebreak + INC2 LDAk walk-on AND ?&while JMP2r + &no-lb INC2 LDAk walk-on AND ?&while JMP2r @@ -386,12 +392,9 @@ JMP2r #15 .Screen/auto DEO &while - LDAk #0a NEQ ?&no-lb - draw-linebreak - INC2 LDAk walk-on AND ?&while JMP2r - &no-lb + ( wrap ) - LDAk #20 NEQ ?&no-wrap + LDAk #20 GTH ?&no-wrap DUP2 word-length .Screen/x DEI2 ADD2 #00d0 LTH2 ?&no-wrap draw-linebreak INC2 LDAk ?&while @@ -413,6 +416,9 @@ JMP2r &block .Screen/x DEO2 + ( tab ) LDAk #09 NEQ ?&no-tab draw-tab &no-tab + ( linebreak ) LDAk #0a NEQ ?&no-lb draw-linebreak &no-lb + INC2 LDAk ?&while POP2 @@ -446,6 +452,12 @@ JMP2r JMP2r +@draw-tab ( -- ) + + .Screen/x DEI2k #0020 ADD2 #33 SFT2 ROT DEO2 + +JMP2r + @draw-linebreak ( -- ) #0008 .Screen/x DEO2