diff --git a/femto.tal b/femto.tal index 436d928..76c0957 100644 --- a/femto.tal +++ b/femto.tal @@ -39,7 +39,6 @@ ( TODO: ) ( - optimize term drawing ) ( - get long line truncation/scrolling working ) -( - page up/page down ) ( - line numbers in left column (toggle mode?) ) ( - help text ) ( - save file command -> tmp first ) @@ -233,16 +232,26 @@ &done BRK @page-up - BRK + ;bof-is-visible JSR2 ,&near-eof JCN + ;buffer/line-offset LDA2 + ;term/rows LDA2 SUB2 #0003 ADD2 + DUP2 ;abs-line JSR2 ;buffer/offset STA2 + ;buffer/line-offset STA2 + ;ensure-visible-cursor JSR2 + ;draw-all JSR2 BRK + &near-eof + #00 ;cursor/row STA + #00 ;cursor/col STA + ;draw-cursor JSR2 BRK @page-down ;eof-is-visible JSR2 ,&near-eof JCN - ;buffer/line-offset LDA2 ;term/rows LDA2 ADD2 #0003 SUB2 - ;buffer/line-count LDA2 ;min2 JSR2 - DUP2 ;abs-line JSR2 ;buffer/offset STA2 - ;buffer/line-offset STA2 - ;ensure-visible-cursor JSR2 - ;draw-all JSR2 BRK + ;buffer/line-offset LDA2 + ;term/rows LDA2 ADD2 #0003 SUB2 + DUP2 ;abs-line JSR2 ;buffer/offset STA2 + ;buffer/line-offset STA2 + ;ensure-visible-cursor JSR2 + ;draw-all JSR2 BRK &near-eof ;buffer/line-count LDA2 ;buffer/line-offset LDA2 INC2 @@ -276,6 +285,9 @@ @at-line-start ( -> bool^ ) ;cursor/col LDA #00 EQU JMP2r +@bof-is-visible ( -> bool^ ) + ;buffer/line-offset LDA2 #0000 EQU2 JMP2r + @eof-is-visible ( -> bool^ ) ;buffer/line-offset LDA2 ;term/rows LDA2 ADD2 INC2 ;buffer/line-count LDA2 @@ -367,8 +379,7 @@ ;rel-line-error ;error! JMP2 ( #00 #00 DIV BRK ) -( TODO: M-v for page up and M-> for goto end ) -( M-f and M-b for next/previous word ) +( TODO: M-f and M-b for next/previous word ) ( M-n and M-p for next/previous paragraph ) ( maybe M-% for search&replace ) @on-key-escaped @@ -399,8 +410,6 @@ ( TODO: C-g or C-h for help ) ( TODO: C-s for search ) -( TODO: C-v for page down ) -( TODO: 8-bit meta/alt? ) ( TODO: tab input? ) @on-key ;saw-esc LDA ;on-key-escaped JCN2