Fix a bug in history refresh

Signed-off-by: Gavin Howard <[email protected]>
This commit is contained in:
Piotr P. Stefaniak 2022-04-10 12:49:12 -06:00 committed by Gavin Howard
parent 3d6c2e4645
commit e0fb717308
Signed by: gavin
GPG Key ID: C08038BDF280D33E
1 changed files with 2 additions and 1 deletions

View File

@ -782,10 +782,11 @@ static void bc_history_refresh(BcHistory *h) {
bc_vec_grow(&h->buf, pos + extras_len);
// Move cursor to original position.
bc_file_putchar(&vm.fout, bc_flush_none, '\r');
colpos = bc_history_colPos(h->buf.v, len - extras_len, pos) + h->pcol;
// Set the cursor position again.
if (colpos) bc_file_printf(&vm.fout, "\r\x1b[%zuC", colpos);
if (colpos) bc_file_printf(&vm.fout, "\x1b[%zuC", colpos);
bc_file_flush(&vm.fout, bc_flush_none);
}