This is an update of Mark H. Wilkinson patch to
samterm to provide acme style mouse chording.

The header to marks email below.

-Steve

From sam-fans-owner Fri Aug 13 12:22:39 1993
Received: from minster.york.ac.uk ([144.32.128.41]) by hawkwind.utcs.toronto.edu
with SMTP id <2685>; Fri, 13 Aug 1993 12:21:52 -0400
From: mhw@minster.york.ac.uk
Date: Fri, 13 Aug 1993 13:14:57 -0400
Message-ID: <swordfish.745258897@minster.york.ac.uk>
Subject: Help-style cut and paste.
To: sam-fans@hawkwind.utcs.toronto.edu
Sender: "Mark H. Wilkinson" <mhw@minster.york.ac.uk>
X-Mailer: Sendmail/ream v4.12bv

I've been using Rob's help system under Plan 9 a bit recently and have
become so used to using mouse button chords to cut and paste that
returning to a system where these operations are selected from a menu
or with key presses feels awkward. Hence this patch, which puts this
feature of help into samterm.

For those who haven't seen help, mouse chords work like this: you select
some text by dragging with the left button down, or by double clicking,
as normal. While holding the left button down at the end of the selection
operation you can immediately cut it by clicking the middle button or
paste over it by clicking the right button. Running these two actions
together (i.e. while holding the left button click the middle button
and then the right button) is equivalent to snarf.

Share and enjoy...

-Mark.

% diff -r /n/sources/plan9/sys/src/cmd/samterm /sys/src/cmd/samterm
diff /n/sources/plan9/sys/src/cmd/samterm/flayer.c /sys/src/cmd/samterm/flayer.c
257a258,259
> if(mousep->msec-l->click<Clicktime)
> ret = 1;
260,266c262,272
< if(mousep->msec-l->click<Clicktime &&
l->f.p0+l->origin==l->p0){
< ret = 1;
< l->click = 0;
< }else
< l->click = mousep->msec;
< }else
< l->click = 0;
---
> if(ret == 1 && l->f.p0+l->origin==l->p0){
> ret = 1;
> l->click = 0;
> }else{
> ret = 0;
> l->click = mousep->msec;
> }
> }else{
> ret = 0;
> l->click = 0;
> }
diff /n/sources/plan9/sys/src/cmd/samterm/main.c /sys/src/cmd/samterm/main.c
25a26
> int chord = 0;
79c80,84
< if(mousep->buttons&1){
---
> if(chord == 1 && !mousep->buttons)
> chord = 0;
> if(chord)
> chord |= mousep->buttons;
> else if(mousep->buttons&1){
91a97,98
> if(mousep->buttons&1)
> chord = mousep->buttons;
105a113,126
> }
> if(chord){
> t = (Text *)which->user1;
> if(!t->lock){
> int w = which-t->l;
> if(chord&2){
> cut(t, w, 1, 1);
> chord &= ~2;
> }
> if(chord&4){
> paste(t, w);
> chord &= ~4;
> }
> }