aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acme/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/acme/text.c')
-rw-r--r--src/cmd/acme/text.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
index 7177127d..aa58be1a 100644
--- a/src/cmd/acme/text.c
+++ b/src/cmd/acme/text.c
@@ -862,7 +862,7 @@ textselect(Text *t)
{
uint q0, q1;
int b, x, y;
- int state;
+ int state, op;
selecttext = t;
/*
@@ -918,12 +918,12 @@ textselect(Text *t)
clicktext = nil;
textsetselect(t, q0, q1);
flushimage(display, 1);
- state = 0; /* undo when possible; +1 for cut, -1 for paste */
+ state = op = 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 && t->what==Body){
+ if(state==0 && op==0 && t->what==Body){
seq++;
filemark(t->w->body.file);
}
@@ -932,18 +932,18 @@ textselect(Text *t)
winundo(t->w, TRUE);
textsetselect(t, q0, t->q0);
state = 0;
- }else if(state != 1){
+ }else if(state != 1 && op != -1){
cut(t, t, nil, TRUE, TRUE, nil, 0);
- state = 1;
+ op = state = 1;
}
}else{
if(state==1 && t->what==Body){
winundo(t->w, TRUE);
textsetselect(t, q0, t->q1);
state = 0;
- }else if(state != -1){
+ }else if(state != -1 && op != 1){
paste(t, t, nil, TRUE, FALSE, nil, 0);
- state = -1;
+ op = state = -1;
}
}
textscrdraw(t);