diff options
author | rsc <devnull@localhost> | 2006-02-08 18:11:57 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2006-02-08 18:11:57 +0000 |
commit | 4ca53ff0e0398171fe9afb1e989b97b30d3d584f (patch) | |
tree | 7f45d1e7662538b6677badd5e3b89f255d0a516b /src/cmd/acme | |
parent | 615e0f9fb2df0e782f6b32ea9f0f67254e1ddeaf (diff) | |
download | plan9port-4ca53ff0e0398171fe9afb1e989b97b30d3d584f.tar.gz plan9port-4ca53ff0e0398171fe9afb1e989b97b30d3d584f.tar.bz2 plan9port-4ca53ff0e0398171fe9afb1e989b97b30d3d584f.zip |
fix b1 c2 c3 c3 c2 c3 [sic]
Diffstat (limited to 'src/cmd/acme')
-rw-r--r-- | src/cmd/acme/text.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c index 95ad545f..44cb6544 100644 --- a/src/cmd/acme/text.c +++ b/src/cmd/acme/text.c @@ -949,7 +949,8 @@ textselect(Text *t) { uint q0, q1; int b, x, y; - int state, op; + int state; + enum { None, Cut, Paste }; selecttext = t; /* @@ -1005,32 +1006,32 @@ textselect(Text *t) clicktext = nil; textsetselect(t, q0, q1); flushimage(display, 1); - state = op = 0; /* undo when possible; +1 for cut, -1 for paste */ + state = None; /* what we've done; undo when possible */ while(mouse->buttons){ mouse->msec = 0; b = mouse->buttons; if((b&1) && (b&6)){ - if(state==0 && t->what==Body){ + if(state==None && t->what==Body){ seq++; filemark(t->w->body.file); } if(b & 2){ - if(state==-1 && t->what==Body){ + if(state==Paste && t->what==Body){ winundo(t->w, TRUE); - textsetselect(t, q0, t->q0); - state = 0; - }else if(state != 1){ + textsetselect(t, q0, t->q1); + state = None; + }else if(state != Cut){ cut(t, t, nil, TRUE, TRUE, nil, 0); - state = 1; + state = Cut; } }else{ - if(state==1 && t->what==Body){ + if(state==Cut && t->what==Body){ winundo(t->w, TRUE); textsetselect(t, q0, t->q1); - state = 0; - }else if(state != -1){ + state = None; + }else if(state != Paste){ paste(t, t, nil, TRUE, FALSE, nil, 0); - state = -1; + state = Paste; } } textscrdraw(t); |