From 5d1ec16e79b0f117420a1f0bb275bb299fdc1d4c Mon Sep 17 00:00:00 2001
From: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Wed, 26 Apr 2023 14:10:39 -0700
Subject: [PATCH] (notepad) Cut char is working

---
 gui/notepad/notepad.tal | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/gui/notepad/notepad.tal b/gui/notepad/notepad.tal
index 1b6d9e2..b08fbb6 100644
--- a/gui/notepad/notepad.tal
+++ b/gui/notepad/notepad.tal
@@ -43,9 +43,18 @@ BRK
 	DUP #44 NEQ ?&no-sl .selection/to LDZ2 #0001 SUB2 select-to &no-sl
 	DUP #84 NEQ ?&no-sr .selection/to LDZ2 INC2 select-to &no-sr
 	POP
-	.Controller/key DEI insert
+	.Controller/key DEI
+	DUP #08 NEQ ?&no-bs
+		erase
+		&no-bs
+	DUP #7f NEQ ?&no-del
+		delete
+		&no-del
+	DUP #09 LTH ?&no-ascii
+		DUP insert
+		&no-ascii
+	POP
 	#00 ;on-frame/f STA
-	redraw
 
 BRK
 
@@ -145,7 +154,7 @@ BRK
 @erase-selection ( -- )
 
 	.selection/from LDZ2 get-eof .selection/length LDZ2 msfl
-	#0000 .selection/length LDZ2 SUB2
+	#0001 .selection/length LDZ2 SUB2
 
 !mod-length
 
@@ -171,13 +180,14 @@ BRK
 
 @erase ( -- )
 
-	.selection/length LDZ2 #0001 EQU2 ?&no-block
+	.selection/length LDZ2 #0000 EQU2 ?&no-block
 		erase-selection
 		!reset-selection
 		&no-block
 
 	.selection/from LDZ2 ;mem NEQ2 [ JMP JMP2r ]
 
+	
 	.selection/from LDZ2 #0001 SUB2
 		DUP2 cut-char
 
@@ -198,13 +208,14 @@ BRK
 
 @get-eof ( -- addr* )
 
-	#a000
+	;mem .textarea/length LDZ2 ADD2
 
 JMP2r
 
 @cut-char ( addr* -- )
 
 	get-eof #0001 msfl
+
 	#ffff
 
 ( >> )