ref: bfe2e4cce116f473a3f3aaf69ce254d99596f3ac
parent: bf206996cdc5bcac447aecddfe3056d07fd749de
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Mon May 13 00:19:10 EDT 2013
rio: fix completion and readback and make it possible to complete history
--- a/sys/src/cmd/rio/wind.c
+++ b/sys/src/cmd/rio/wind.c
@@ -471,7 +471,7 @@
int i;
Fmt f;
Rune *rp;
- uint nr, qline, q0;
+ uint nr, qline;
char *s;
runefmtstrinit(&f);
@@ -490,20 +490,21 @@
}
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*
--
⑨