rio: fix completion and readback and make it possible to complete history
This commit is contained in:
parent
7b4c8aac93
commit
303394314a
1 changed files with 12 additions and 11 deletions
|
@ -471,7 +471,7 @@ showcandidates(Window *w, Completion *c)
|
||||||
int i;
|
int i;
|
||||||
Fmt f;
|
Fmt f;
|
||||||
Rune *rp;
|
Rune *rp;
|
||||||
uint nr, qline, q0;
|
uint nr, qline;
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
runefmtstrinit(&f);
|
runefmtstrinit(&f);
|
||||||
|
@ -490,20 +490,21 @@ showcandidates(Window *w, Completion *c)
|
||||||
}
|
}
|
||||||
fmtprint(&f, "]\n");
|
fmtprint(&f, "]\n");
|
||||||
}
|
}
|
||||||
/* place text at beginning of line before host point */
|
|
||||||
qline = w->qh;
|
|
||||||
while(qline>0 && w->r[qline-1] != '\n')
|
|
||||||
qline--;
|
|
||||||
|
|
||||||
rp = runefmtstrflush(&f);
|
rp = runefmtstrflush(&f);
|
||||||
nr = runestrlen(rp);
|
nr = runestrlen(rp);
|
||||||
|
|
||||||
q0 = w->q0;
|
/* place text at beginning of line before cursor */
|
||||||
q0 += winsert(w, rp, nr, qline) - qline;
|
qline = w->q0;
|
||||||
if(q0 >= w->qh)
|
while(qline>0 && w->r[qline-1] != '\n')
|
||||||
w->qh += nr;
|
qline--;
|
||||||
|
|
||||||
|
if(qline == w->qh){
|
||||||
|
/* advance host point to avoid readback */
|
||||||
|
w->qh = winsert(w, rp, nr, qline)+nr;
|
||||||
|
} else {
|
||||||
|
winsert(w, rp, nr, qline);
|
||||||
|
}
|
||||||
free(rp);
|
free(rp);
|
||||||
wsetselect(w, q0+nr, q0+nr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rune*
|
Rune*
|
||||||
|
|
Loading…
Reference in a new issue