Better fix for patch applied/acmechord.
Thanks to Arvindht Tamilmani for pointing out the problem.
[rsc] --rw-rw-r-- M 12721 glenda sys 27870 Dec 31 16:27 sys/src/cmd/acme/text.c
/n/sourcesdump/2005/1231/plan9/sys/src/cmd/acme/text.c:882,888 -
/n/sourcesdump/2006/0101/plan9/sys/src/cmd/acme/text.c:882,888
{
uint q0, q1;
int b, x, y;
- int state, op;
+ int state;
selecttext = t;
/*
/n/sourcesdump/2005/1231/plan9/sys/src/cmd/acme/text.c:938,949 -
/n/sourcesdump/2006/0101/plan9/sys/src/cmd/acme/text.c:938,949
clicktext = nil;
textsetselect(t, q0, q1);
flushimage(display, 1);
- state = op = 0; /* undo when possible; +1 for cut, -1 for paste */
+ state = 0; /* undo when possible; +1 for cut, -1 for paste */
while(mouse->buttons){
mouse->msec = 0;
b = mouse->buttons;
- if(b & 6){
- if(state==0 && op==0 && t->what==Body){
+ if((b&1) && (b&6)){
+ if(state==0 && t->what==Body){
seq++;
filemark(t->w->body.file);
}
/n/sourcesdump/2005/1231/plan9/sys/src/cmd/acme/text.c:952,960 -
/n/sourcesdump/2006/0101/plan9/sys/src/cmd/acme/text.c:952,960
winundo(t->w, TRUE);
textsetselect(t, q0, t->q0);
state = 0;
- }else if(state != 1 && op != -1){
+ }else if(state != 1){
cut(t, t, nil, TRUE, TRUE, nil, 0);
- op = state = 1;
+ state = 1;
}
}else{
if(state==1 && t->what==Body){
/n/sourcesdump/2005/1231/plan9/sys/src/cmd/acme/text.c:961,969 -
/n/sourcesdump/2006/0101/plan9/sys/src/cmd/acme/text.c:961,969
winundo(t->w, TRUE);
textsetselect(t, q0, t->q1);
state = 0;
- }else if(state != -1 && op != 1){
+ }else if(state != -1){
paste(t, t, nil, TRUE, FALSE, nil, 0);
- op = state = -1;
+ state = -1;
}
}
textscrdraw(t);
[rsc] --rw-rw-r-- M 12721 glenda sys 28267 Dec 31 16:27 sys/src/cmd/acme/exec.c
/n/sourcesdump/2005/1231/plan9/sys/src/cmd/acme/exec.c:661,667 -
/n/sourcesdump/2006/0101/plan9/sys/src/cmd/acme/exec.c:661,667
Rune *r;
/* use current window if snarfing and its selection is non-null */
- if(et!=nil && dosnarf && et->w!=nil){
+ if(et!=nil && dosnarf && et->w!=nil && t==nil){
if(et->w->body.q1>et->w->body.q0){
t = &et->w->body;
if(docut)
[rsc] --rw-rw-r-- M 12721 glenda sys 27870 Dec 31 16:27 sys/src/cmd/acme/text.c
|