fix selection bug on empty region

This commit is contained in:
~d6 2023-02-13 22:56:04 -05:00
parent c822d1543e
commit 108f6a22be
1 changed files with 5 additions and 3 deletions

View File

@ -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* )