fix forward, sort of fix back

This commit is contained in:
~d6 2022-03-25 23:17:34 -04:00
parent 354cdc802e
commit 42ea10b6f9
1 changed files with 17 additions and 6 deletions

View File

@ -185,7 +185,7 @@
JMP2r JMP2r
@setup-terminal-size ( -> ) @setup-terminal-size ( -> )
#03e7 #03e7 ;term-move-cursor JSR2 #03e7 DUP2 ;term-move-cursor JSR2
;term-get-cursor-position JSR2 ;term-get-cursor-position JSR2
;tmp/data .tmp/pos STZ2 ;tmp/data .tmp/pos STZ2
;receive-terminal-size .Console/vector DEO2 ;receive-terminal-size .Console/vector DEO2
@ -257,7 +257,8 @@
( FIXME: handle long lines ) ( FIXME: handle long lines )
@forward ( -> ) @forward ( -> )
;cur-pos JSR2 ;last-pos JSR2 GTH2 ,&skip JCN ;cur-pos JSR2 ;last-pos JSR2 GTH2 ,&skip JCN
;cur-col JSR2 ;cur-last JSR2 GTH2 ,&next-line JCN ;cur-col JSR2 ;cur-len JSR2 LTH2 ,&normal JCN ,&next-line JMP
&normal
;cur-col JSR2 INC2 .cursor/col STZ2 ;cur-col JSR2 INC2 .cursor/col STZ2
;draw-statusbar-and-cursor JSR2 ;draw-statusbar-and-cursor JSR2
,&skip JMP ,&skip JMP
@ -269,10 +270,14 @@
( FIXME: handle long lines ) ( FIXME: handle long lines )
@back ( -> ) @back ( -> )
;cur-col JSR2 #01 LTH ,&skip JCN ;cur-col JSR2 #0001 LTH2 ,&next-line JCN
;cur-col JSR2 #0001 SUB2 .cursor/col STZ2 ;cur-col JSR2 #0001 SUB2 .cursor/col STZ2
;draw-statusbar-and-cursor JSR2 ;draw-statusbar-and-cursor JSR2 BRK
&skip BRK &next-line
;dec-row JSR2
;cur-len JSR2 .cursor/col STZ2
;ensure-visible-cursor JSR2 ( FIXME )
;draw-cursor JSR2 BRK
@up ( -> ) @up ( -> )
;cur-abs-row JSR2 #0000 EQU2 ,&done JCN ;cur-abs-row JSR2 #0000 EQU2 ,&done JCN
@ -401,6 +406,12 @@
GTH2 JMP2r GTH2 JMP2r
@backspace ( -> ) @backspace ( -> )
;cur-col JSR2 #01 LTH ,&skip JCN
;cur-col JSR2 #0001 SUB2 .cursor/col STZ2
;delete JMP2
&skip BRK
( @backspace ( -> )
#01 .state/modified STZ #01 .state/modified STZ
;at-buffer-start JSR2 ,&skip JCN ;at-buffer-start JSR2 ,&skip JCN
;at-line-start JSR2 ,&prev-line JCN ;at-line-start JSR2 ,&prev-line JCN
@ -415,7 +426,7 @@
;cur-pos JSR2 ;shift-left JSR2 ;cur-pos JSR2 ;shift-left JSR2
;draw-all JSR2 BRK ;draw-all JSR2 BRK
&skip &skip
;draw-cursor JSR2 BRK ;draw-cursor JSR2 BRK )
@backspace-prompt ( -> ) @backspace-prompt ( -> )
#00 .tmp/pos LDZ2 #0001 SUB2 ( 0 pos-1 ) #00 .tmp/pos LDZ2 #0001 SUB2 ( 0 pos-1 )