add chord fix from plan 9

This commit is contained in:
rsc 2006-02-06 23:10:48 +00:00
parent 6cb755b60b
commit 8b9a1d4cfe
2 changed files with 10 additions and 7 deletions

View file

@ -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);

View file

@ -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;
}