提交 a2d6a041 authored 作者: Travis Cross's avatar Travis Cross

fs_cli: ask less of the terminal; fix ctrl-l behavior

上级 fe609386
...@@ -575,7 +575,6 @@ static int stdout_writable(void) ...@@ -575,7 +575,6 @@ static int stdout_writable(void)
static void clear_line(void) static void clear_line(void)
{ {
printf("\033[s");
putchar('\r'); putchar('\r');
printf("\033[K"); printf("\033[K");
fflush(stdout); fflush(stdout);
...@@ -591,7 +590,12 @@ static void redisplay(void) ...@@ -591,7 +590,12 @@ static void redisplay(void)
putchar(*c); putchar(*c);
c++; c++;
} }
printf("\033[u"); {
int pos = (int)(lf->cursor - lf->buffer);
putchar('\r');
printf("\033[%dC", bare_prompt_str_len);
if (pos > 0) printf("\033[%dC", pos);
}
fflush(stdout); fflush(stdout);
return; return;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论