From ef80d8844b636034c494d2b9dd6c66425df110b0 Mon Sep 17 00:00:00 2001 From: d6 Date: Thu, 24 Mar 2022 23:21:35 -0400 Subject: [PATCH] fix a few bugs --- femto.tal | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/femto.tal b/femto.tal index 8f54ac8..c5f5bfd 100644 --- a/femto.tal +++ b/femto.tal @@ -319,8 +319,7 @@ quit! &is-modified ;messages/quit-prompt ;messages/null ;do-quit ;start-prompt JSR2 - ;draw-prompt JSR2 - ;draw-cursor JSR2 + ;draw-prompt-and-cursor JSR2 BRK @do-quit @@ -349,8 +348,7 @@ .tmp/pos LDZ2 STH2k STA ( data[pos] <- c ) INC2r #00 STH2kr STA ( data[pos+1] <- 0 ) STH2r .tmp/pos STZ2 ( pos <- pos+1 ) - ;draw-prompt JSR2 - ;draw-cursor JSR2 + ;draw-prompt-and-cursor JSR2 BRK @insert-tab ( -> ) @@ -405,8 +403,9 @@ .buffer/line-count LDZ2k #0001 SUB2 ROT STZ2 &finish ;cur-pos JSR2 ;shift-left JSR2 - ;draw-all JSR2 - &skip BRK + ;draw-all JSR2 BRK + &skip + ;draw-cursor JSR2 BRK @backspace-prompt ( -> ) #00 .tmp/pos LDZ2 #0001 SUB2 ( 0 pos-1 ) @@ -418,14 +417,13 @@ @delete ( -> ) #01 .state/modified STZ - ;last-pos JSR2 #0001 SUB2 ( lst-1 ) - ;cur-pos JSR2 LTH2 ,&skip JCN + ;last-pos JSR2 ;cur-pos JSR2 LTH2 ,&skip JCN ;cur-pos JSR2 LDAk STH ( cur [c] ) ;shift-left JSR2 ( [c] ) STHr #0a NEQ ,¬-newline JCN .buffer/line-count LDZ2k #0001 SUB2 ROT STZ2 - ¬-newline ;draw-all JSR2 - &skip BRK + ¬-newline ;draw-all JSR2 BRK + &skip ;draw-cursor JSR2 BRK @escape ( -> ) #01 .state/saw-esc STZ BRK @@ -451,8 +449,7 @@ @goto-line ( -> ) ;messages/goto-line ;messages/null ;do-goto-line ;start-prompt JSR2 - ;draw-prompt JSR2 - ;draw-cursor JSR2 + ;draw-prompt-and-cursor JSR2 BRK @parse-decimal-number ( addr* -> n* ok^ ) @@ -546,8 +543,8 @@ #0000 DIV &is-active #00 .prompt/active STZ - ;draw-prompt JSR2 - ;draw-cursor JSR2 + #00 .state/quitting STZ + ;draw-prompt-and-cursor JSR2 BRK ( when called vector should end in BRK ) @@ -562,8 +559,7 @@ @save ;messages/save-prompt ;filename ;do-save ;start-prompt JSR2 - ;draw-prompt JSR2 - ;draw-cursor JSR2 + ;draw-prompt-and-cursor JSR2 BRK @do-save ( -> ) @@ -779,6 +775,10 @@ ;tmp/data ;print JSR2 JMP2r +@draw-prompt-and-cursor ( -> ) + ;draw-prompt JSR2 + ;draw-cursor JMP2 + @draw-linenum ( n* -> ) ;emit-reset JSR2 ansi .config/color LDZ2 emit emit LIT 'm emit @@ -845,8 +845,7 @@ &done POP2 POP2r POP2r ;emit-reset JSR2 ;draw-statusbar JSR2 - ;draw-prompt JSR2 - ;draw-cursor JSR2 + ;draw-prompt-and-cursor JSR2 JMP2r @str-copy ( src* dst* -> )