From 108f6a22be047bd367baf7b15c1a9f2a29bb35e0 Mon Sep 17 00:00:00 2001 From: d6 Date: Mon, 13 Feb 2023 22:56:04 -0500 Subject: [PATCH] fix selection bug on empty region --- term.tal | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/term.tal b/term.tal index 4287428..c3e3859 100644 --- a/term.tal +++ b/term.tal @@ -419,14 +419,16 @@ @copy-line ( y* x1* x0* -> y* ) STH2 STH2 DUP2 find-natural-end ( y* xend* [x0* x1*] ) STH2r min ( y* xlim=min(xend,x1)* [x0*] ) - OVR2 .cols LDZ2 MUL2 ( y* xlim* y*cols* [x0*] ) + DUP2 STH2kr GTH2 ,&ok ( y* xlim* [x0*] ) + POP2 POP2r JMP2r ( y* ; return if line is empty ) + &ok OVR2 .cols LDZ2 MUL2 ( y* xlim* y*cols* [x0*] ) STH2kr ADD2 #10 SFT2 ;cells ADD2 ( y* xlim* addr* [x0*] ) INC2 STH2 SWP2r STH2r ( y* xlim* x0* [addr+1*] ) SUB2 INC2 #0000 SWP2 SUB2 ( y* -count* [addr+1*] ) &loop ( y* -i* [pos*] ) LDAkr STHr copy-char ( y* -i* [pos*] ) INC2 INC2r INC2r ORAk ?&loop ( y* -i+1* [pos+2*] ) - POP2 POP2r JMP2r ( y* ) + POP2 POP2r JMP2r ( y* ; done ) @copy-char ( c^ -> ) DUP ?&ok POP #20 ( replace \0 with space ) @@ -512,7 +514,7 @@ .lastmouse-x LDZ2 .lastmouse-y LDZ2 ( lx* ly* ) #0200 ;cp437 ADD2 draw-at ( ) .is-lit LDZ #00 EQU ?&next - update-selection ( redraw-selection ) + update-selection #01 .dirty STZ &next .Mouse/x DEI2 .Mouse/y DEI2 ( x* y* )