sam: chording
This commit is contained in:
parent
c00f5f5192
commit
0c22c05a96
2 changed files with 29 additions and 13 deletions
|
@ -252,21 +252,18 @@ fldelete(Flayer *l, long p0, long p1)
|
||||||
int
|
int
|
||||||
flselect(Flayer *l)
|
flselect(Flayer *l)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
if(l->visible!=All)
|
if(l->visible!=All)
|
||||||
flupfront(l);
|
flupfront(l);
|
||||||
frselect(&l->f, mousectl);
|
if(l->f.p0==l->f.p1)
|
||||||
ret = 0;
|
if(mousep->msec-l->click<Clicktime && l->f.p0+l->origin==l->p0 &&
|
||||||
if(l->f.p0==l->f.p1){
|
l->f.p0==frcharofpt(&l->f, mousep->xy)){
|
||||||
if(mousep->msec-l->click<Clicktime && l->f.p0+l->origin==l->p0){
|
|
||||||
ret = 1;
|
|
||||||
l->click = 0;
|
l->click = 0;
|
||||||
}else
|
return 1;
|
||||||
|
}
|
||||||
l->click = mousep->msec;
|
l->click = mousep->msec;
|
||||||
}else
|
frselect(&l->f, mousectl);
|
||||||
l->click = 0;
|
|
||||||
l->p0 = l->f.p0+l->origin, l->p1 = l->f.p1+l->origin;
|
l->p0 = l->f.p0+l->origin, l->p1 = l->f.p1+l->origin;
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -28,7 +28,7 @@ int autoindent;
|
||||||
void
|
void
|
||||||
threadmain(int argc, char *argv[])
|
threadmain(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, got, scr;
|
int i, got, scr, chord;
|
||||||
Text *t;
|
Text *t;
|
||||||
Rectangle r;
|
Rectangle r;
|
||||||
Flayer *nwhich;
|
Flayer *nwhich;
|
||||||
|
@ -51,6 +51,7 @@ threadmain(int argc, char *argv[])
|
||||||
startnewfile(Tstartcmdfile, &cmd);
|
startnewfile(Tstartcmdfile, &cmd);
|
||||||
|
|
||||||
got = 0;
|
got = 0;
|
||||||
|
chord = 0;
|
||||||
for(;;got = waitforio()){
|
for(;;got = waitforio()){
|
||||||
if(hasunlocked && RESIZED())
|
if(hasunlocked && RESIZED())
|
||||||
resize();
|
resize();
|
||||||
|
@ -77,7 +78,23 @@ threadmain(int argc, char *argv[])
|
||||||
scr = which && ptinrect(mousep->xy, which->scroll);
|
scr = which && ptinrect(mousep->xy, which->scroll);
|
||||||
if(mousep->buttons)
|
if(mousep->buttons)
|
||||||
flushtyping(1);
|
flushtyping(1);
|
||||||
if(mousep->buttons&1){
|
if((mousep->buttons&1) == 0)
|
||||||
|
chord = 0;
|
||||||
|
if(chord && which && which==nwhich){
|
||||||
|
chord |= mousep->buttons;
|
||||||
|
t = (Text *)which->user1;
|
||||||
|
if(!t->lock){
|
||||||
|
int w = which-t->l;
|
||||||
|
if(chord&2){
|
||||||
|
cut(t, w, 1, 1);
|
||||||
|
chord &= ~2;
|
||||||
|
}
|
||||||
|
if(chord&4){
|
||||||
|
paste(t, w);
|
||||||
|
chord &= ~4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(mousep->buttons&1){
|
||||||
if(nwhich){
|
if(nwhich){
|
||||||
if(nwhich!=which)
|
if(nwhich!=which)
|
||||||
current(nwhich);
|
current(nwhich);
|
||||||
|
@ -90,6 +107,8 @@ threadmain(int argc, char *argv[])
|
||||||
t->lock++;
|
t->lock++;
|
||||||
}else if(t!=&cmd)
|
}else if(t!=&cmd)
|
||||||
outcmd();
|
outcmd();
|
||||||
|
if(mousep->buttons&1)
|
||||||
|
chord = mousep->buttons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if((mousep->buttons&2) && which){
|
}else if((mousep->buttons&2) && which){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue