Added copy/paste

This commit is contained in:
Devine Lu Linvega 2023-04-26 21:34:36 -07:00
parent 76d1eb996e
commit 7cefdc4be8
1 changed files with 52 additions and 5 deletions

View File

@ -6,9 +6,6 @@
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2 |a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
( TODOs: ( TODOs:
> Select all
> Copy/Paste
> Clamp selection
> Show blinker on last character > Show blinker on last character
> Mouse2 select word > Mouse2 select word
> Page memory mapping ) > Page memory mapping )
@ -278,17 +275,67 @@ JMP2r
JMP2r JMP2r
&false POP2 #00 JMP2r &false POP2 #00 JMP2r
@edit-cut ( -- ) @file-size ( path* -- size* )
.File/name DEO2
#0001 .File/length DEO2
[ LIT2r 0000 ]
&s
;&b .File/read DEO2
.File/success DEI2 #0000 EQU2 ?&eof
INC2r !&s &eof
STH2r
JMP2r JMP2r
&b $1
@file-inject ( name* -- )
DUP2 file-size
ORAk ?&exists
POP2 POP2 JMP2r
&exists
STH2
.File/name DEO2
STH2kr .File/length DEO2
( erase when selection length )
.selection/length LDZ2 #0001 EQU2 ?&no-selection
erase-selection
&no-selection
( push right ) .selection/from LDZ2 #0001 SUB2
get-eof STH2kr msfr
STH2kr mod-length
.selection/from LDZ2 .File/read DEO2
.selection/from LDZ2 STH2r ADD2
!select-from
@edit-cut ( -- )
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ]
edit-copy
erase-selection
!select-reset
@edit-copy ( -- ) @edit-copy ( -- )
.selection/length LDZ2 #0001 GTH2 [ JMP JMP2r ]
;snarf-txt .File/name DEO2
.selection/length LDZ2 .File/length DEO2
.selection/from LDZ2 .File/write DEO2
JMP2r JMP2r
@edit-paste ( -- ) @edit-paste ( -- )
JMP2r ;snarf-txt
!file-inject
@snarf-txt ".snarf $1
( (
@|core ) @|core )