~rabbits/public-inbox

oekaki: Add guides when pasting a snarf v1 PROPOSED

Jules Maselbas: 1
 Add guides when pasting a snarf

 1 files changed, 12 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~rabbits/public-inbox/patches/55170/mbox | git am -3
Learn more about email & git

[PATCH oekaki] Add guides when pasting a snarf Export this patch

The snarf is aligned on a tile basis, so are the guides

---
 src/oekaki.tal | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/oekaki.tal b/src/oekaki.tal
index 9d30d46..c52600f 100644
--- a/src/oekaki.tal
+++ b/src/oekaki.tal
@@ -440,15 +440,15 @@
	JMP2r

	&up ( -- )
	[ LIT &paste $1 ] ?{ !<paste-snarf> }
	<clear-guide>
	[ LIT &paste $1 ] ?{ !<paste-snarf> }
	( ) [ LIT2 &real-x $2 ] #33 SFT2 [ LIT2 &real-y $2 ] #33 SFT2
	( ) get-touch-x #33 SFT2 get-touch-y #33 SFT2 !<snarf-rect>

	&drag ( -- )
	( ) .Mouse/x DEI2 #0010 GTH2 ?{ <hide-menu> }
	,&paste LDR ?{ JMP2r }
	<clear-guide>
	,&paste LDR ?{ .Mouse/x DEI2 .Mouse/y DEI2 !<guide-snarf> }
	( ) [ LIT2 &x $2 ] [ LIT2 &y $2 ]
	( ) .Mouse/x DEI2 .Mouse/y DEI2 <guide-rect>
	#43 ;selector-icn !<update-cursor>
@@ -677,6 +677,16 @@
	POP2 POP2 JMP2r
	&size &width $2 &height $2

@<guide-snarf> ( x* y* -- )
	SWP2 #33 SFT2 SWP2 #33 SFT2
	;dict/snarf-ext .File/name DEO2
	#0002 .File/length DEO2
	;&width .File/read DEO2
	;&height .File/read DEO2
	OVR2 [ LIT2 &width $2 ] ADD2
	OVR2 [ LIT2 &height $2 ] ADD2
	!<guide-rect>

@<paste-snarf> ( -- )
	;dict/snarf-ext .File/name DEO2
	#0002 .File/length DEO2
-- 
2.45.2