goto-line is working

This commit is contained in:
~d6 2022-03-24 00:09:55 -04:00
parent 0c5cbd982a
commit 676d9f5405
2 changed files with 43 additions and 8 deletions

View File

@ -452,8 +452,44 @@
BRK BRK
@goto-line ( -> ) @goto-line ( -> )
#0016 ;jump-to-line JSR2 ;messages/goto-line ;messages/null ;do-goto-line ;start-prompt JSR2
;draw-all JSR2 BRK ;draw-prompt JSR2
;draw-cursor JSR2
BRK
@parse-decimal-number ( addr* -> n* ok^ )
LDAk ,&non-empty JCN
#00 JMP2r
&non-empty
LIT2r 0000
&loop
LDAk ,&continue JCN
POP2 STH2r #01 JMP2r
&continue
LDAk LIT '0 LTH ,&fail JCN
LDAk LIT '9 GTH ,&fail JCN
LIT2r 000a MUL2r
LDAk LIT '0 SUB #00 SWP STH2 ADD2r
INC2 ,&loop JMP
&fail
POP2r #00 JMP2r
@do-goto-line
;tmp/data ;parse-decimal-number JSR2
,&ok JCN
;move-to-message-line JSR2
;messages/unknown-input ;print JSR2
;tmp/data ;print JSR2
BRK
&ok
#0001 SUB2 ( convert 1-indexing to 0-indexing )
DUP2 .buffer/line-count LDZ2 LTH2 ,&within JCN
POP2 ;goto-end JMP2
&within
;jump-to-line JSR2
;draw-all JSR2
BRK
@jump-to-line ( n* -> ) @jump-to-line ( n* -> )
.term/rows LDZ2 #0002 DIV2 LTH2k ( n rows/2 n<rows/2? ) ,&early JCN .term/rows LDZ2 #0002 DIV2 LTH2k ( n rows/2 n<rows/2? ) ,&early JCN
@ -978,6 +1014,7 @@
&save-ok "Successfully 20 "saved 20 00 &save-ok "Successfully 20 "saved 20 00
&save-failed "Failed 20 "to 20 "save 20 00 &save-failed "Failed 20 "to 20 "save 20 00
&lines 20 "lines] 00 &lines 20 "lines] 00
&goto-line "Go 20 "to 20 "line: 20 00
&save-prompt "File 20 "Name 20 "to 20 "Write: 20 00 &save-prompt "File 20 "Name 20 "to 20 "Write: 20 00
&quit-prompt "Save 20 "modified 20 "file 20 "(y/n)? 20 00 &quit-prompt "Save 20 "modified 20 "file 20 "(y/n)? 20 00
&unknown-input "Unknown 20 "input: 20 00 &unknown-input "Unknown 20 "input: 20 00

View File

@ -45,22 +45,20 @@ the femto status line contains a lot of information:
C-o save C-o save
C-x quit C-x quit
C-a go to beginning of line
C-e go to end of line
C-b move back one character C-b move back one character
C-f move forward one character C-f move forward one character
C-n move down one line C-n move down one line
C-p move up one line C-p move up one line
M-v page up M-v page up
C-v page down C-v page down
C-a go to beginning of line
C-e go to end of line
M-< go to start of file M-< go to start of file
M-> go to end of file M-> go to end of file
M-g go to line (TODO) M-g go to line
C-l refresh screen C-l refresh screen (DEBUG)
C-d delete C-d delete
(C stands for Control) (C stands for Control)