(notepad) Removed length

This commit is contained in:
Devine Lu Linvega 2023-04-26 21:54:55 -07:00
parent b047ef59f7
commit ae2b25044d
1 changed files with 17 additions and 23 deletions

View File

@ -8,13 +8,13 @@
( TODOs: ( TODOs:
> Show blinker on last character > Show blinker on last character
> Mouse2 select word > Mouse2 select word
> Page memory mapping ) > Page memory mapping
> Always select end of note on change )
|0000 |0000
@page $1 @page $1
@selection &from $2 &to $2 &length $2 @selection &from $2 &to $2 &length $2
@textarea &length $2
|0100 |0100
@ -32,7 +32,6 @@
;on-frame .Screen/vector DEO2 ;on-frame .Screen/vector DEO2
;on-control .Controller/vector DEO2 ;on-control .Controller/vector DEO2
( init ) ( init )
;mem/end ;mem SUB2 .textarea/length STZ2
;mem select-from ;mem select-from
draw-header draw-header
draw-note draw-note
@ -43,7 +42,7 @@ BRK
.Controller/key DEI .Controller/button DEI .Controller/key DEI .Controller/button DEI
( shortcuts ) ( shortcuts )
DUP2 [ LIT2 "a 01 ] NEQ2 ?&no-ca POP2 select-all JMP2r &no-ca DUP2 [ LIT2 "a 01 ] NEQ2 ?&no-ca POP2 select-all BRK &no-ca
DUP2 [ LIT2 "x 01 ] NEQ2 ?&no-cx POP2 edit-cut BRK &no-cx DUP2 [ LIT2 "x 01 ] NEQ2 ?&no-cx POP2 edit-cut BRK &no-cx
DUP2 [ LIT2 "c 01 ] NEQ2 ?&no-cc POP2 edit-copy BRK &no-cc DUP2 [ LIT2 "c 01 ] NEQ2 ?&no-cc POP2 edit-copy BRK &no-cc
DUP2 [ LIT2 "v 01 ] NEQ2 ?&no-cv POP2 edit-paste BRK &no-cv DUP2 [ LIT2 "v 01 ] NEQ2 ?&no-cv POP2 edit-paste BRK &no-cv
@ -155,13 +154,6 @@ BRK
( (
@|editor ) @|editor )
@erase-selection ( -- )
.selection/from LDZ2 get-eof .selection/length LDZ2 msfl
#0001 .selection/length LDZ2 SUB2
!mod-length
@insert ( char -- ) @insert ( char -- )
( move ) #fff0 get-eof SUB2 ORA ?&valid ( move ) #fff0 get-eof SUB2 ORA ?&valid
@ -176,7 +168,6 @@ BRK
&no-block &no-block
.selection/from LDZ2 STH2k #0001 SUB2 get-eof #0001 msfr .selection/from LDZ2 STH2k #0001 SUB2 get-eof #0001 msfr
#0001 mod-length
STH2kr STA STH2kr STA
STH2r INC2 STH2r INC2
@ -196,6 +187,12 @@ BRK
!select-from !select-from
@erase-selection ( -- )
.selection/from LDZ2 get-eof .selection/length LDZ2 msfl
JMP2r
@delete ( -- ) @delete ( -- )
get-eof .selection/from LDZ2 SUB2 ORA #01 [ JCN JMP2r ] get-eof .selection/from LDZ2 SUB2 ORA #01 [ JCN JMP2r ]
@ -211,7 +208,7 @@ BRK
@get-eof ( -- addr* ) @get-eof ( -- addr* )
;mem .textarea/length LDZ2 ADD2 ;mem scap
JMP2r JMP2r
@ -219,16 +216,11 @@ JMP2r
get-eof #0001 msfl get-eof #0001 msfl
#ffff
( >> )
@mod-length ( change* -- )
.textarea/length LDZ2 ADD2 .textarea/length STZ2
JMP2r JMP2r
(
@|selection )
@select-reset ( -- ) @select-reset ( -- )
.selection/from LDZ2 .selection/from LDZ2
@ -260,7 +252,7 @@ JMP2r
@select-all ( -- ) @select-all ( -- )
;mem .selection/from STZ2 ;mem .selection/from STZ2
;mem .textarea/length LDZ2 ADD2 #0001 SUB2 .selection/to STZ2 ;mem scap .selection/to STZ2
.selection/to LDZ2 .selection/from LDZ2 SUB2 .selection/length STZ2 .selection/to LDZ2 .selection/from LDZ2 SUB2 .selection/length STZ2
@ -275,6 +267,9 @@ JMP2r
JMP2r JMP2r
&false POP2 #00 JMP2r &false POP2 #00 JMP2r
(
@|file )
@file-size ( path* -- size* ) @file-size ( path* -- size* )
.File/name DEO2 .File/name DEO2
@ -304,7 +299,6 @@ JMP2r
&no-selection &no-selection
( push right ) .selection/from LDZ2 #0001 SUB2 ( push right ) .selection/from LDZ2 #0001 SUB2
get-eof STH2kr msfr get-eof STH2kr msfr
STH2kr mod-length
.selection/from LDZ2 .File/read DEO2 .selection/from LDZ2 .File/read DEO2
.selection/from LDZ2 STH2r ADD2 .selection/from LDZ2 STH2r ADD2