summaryrefslogtreecommitdiff
path: root/sys/src/cmd/rio
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-05-13 04:19:10 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-05-13 04:19:10 +0200
commit303394314aa041cf52cbb02441aca04f12aafddf (patch)
treed5f5fd44c67e604a31c320e5c62f33e6117b1821 /sys/src/cmd/rio
parent7b4c8aac930b440ca2f4a877f0459f75c8f2fe70 (diff)
rio: fix completion and readback and make it possible to complete history
Diffstat (limited to 'sys/src/cmd/rio')
-rw-r--r--sys/src/cmd/rio/wind.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/src/cmd/rio/wind.c b/sys/src/cmd/rio/wind.c
index 8752090c7..b96f8b986 100644
--- a/sys/src/cmd/rio/wind.c
+++ b/sys/src/cmd/rio/wind.c
@@ -471,7 +471,7 @@ showcandidates(Window *w, Completion *c)
int i;
Fmt f;
Rune *rp;
- uint nr, qline, q0;
+ uint nr, qline;
char *s;
runefmtstrinit(&f);
@@ -490,20 +490,21 @@ showcandidates(Window *w, Completion *c)
}
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);
nr = runestrlen(rp);
- q0 = w->q0;
- q0 += winsert(w, rp, nr, qline) - qline;
- if(q0 >= w->qh)
- w->qh += nr;
+ /* place text at beginning of line before cursor */
+ qline = w->q0;
+ while(qline>0 && w->r[qline-1] != '\n')
+ 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);
- wsetselect(w, q0+nr, q0+nr);
}
Rune*