aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-02-06 23:10:48 +0000
committerrsc <devnull@localhost>2006-02-06 23:10:48 +0000
commit8b9a1d4cfefb87cb89835880d528ce8d8b5eecdc (patch)
tree9d4ae054152767aadb4bc987b21a25a40e46fd4d
parent6cb755b60b5bc5410bd90c37f3bf3b50ebcfe789 (diff)
downloadplan9port-8b9a1d4cfefb87cb89835880d528ce8d8b5eecdc.tar.gz
plan9port-8b9a1d4cfefb87cb89835880d528ce8d8b5eecdc.tar.bz2
plan9port-8b9a1d4cfefb87cb89835880d528ce8d8b5eecdc.zip
add chord fix from plan 9
-rw-r--r--src/cmd/acme/text.c12
-rw-r--r--src/cmd/acme/wind.c5
2 files changed, 10 insertions, 7 deletions
diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
index 0e089105..95ad545f 100644
--- a/src/cmd/acme/text.c
+++ b/src/cmd/acme/text.c
@@ -1009,8 +1009,8 @@ textselect(Text *t)
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);
}
@@ -1019,18 +1019,18 @@ textselect(Text *t)
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){
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);
diff --git a/src/cmd/acme/wind.c b/src/cmd/acme/wind.c
index 2b0369dd..a2106ed2 100644
--- a/src/cmd/acme/wind.c
+++ b/src/cmd/acme/wind.c
@@ -115,9 +115,12 @@ wintaglines(Window *w, Rectangle r)
/* if tag ends with \n, include empty line at end for typing */
n = w->tag.fr.nlines;
- bufread(&w->tag.file->b, w->tag.file->b.nc-1, &rune, 1);
+ if(w->tag.file->b.nc > 0)
+ bufread(&w->tag.file->b, w->tag.file->b.nc-1, &rune, 1);
if(rune == '\n')
n++;
+ if(n == 0)
+ n = 1;
return n;
}