From 51b800acd6a7e888f3e5d926eb475f5452594793 Mon Sep 17 00:00:00 2001 From: denis Date: Wed, 11 Mar 2015 20:46:48 +0300 Subject: [PATCH] improve shell compatibility with vt100, fix #57 --- src/linenoise.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/linenoise.c b/src/linenoise.c index fb415830..77c9e1ff 100644 --- a/src/linenoise.c +++ b/src/linenoise.c @@ -131,7 +131,7 @@ static void refreshLine(const char *prompt, char *buf, size_t len, size_t pos, s } /* Cursor to left edge */ - snprintf(seq,MAX_SEQ_LEN,"\x1b[0G"); + snprintf(seq,MAX_SEQ_LEN,"\r"); term_putstr( seq, strlen( seq ) ); /* Write the prompt and the current buffer content */ term_putstr( prompt, strlen( prompt ) ); @@ -140,7 +140,7 @@ static void refreshLine(const char *prompt, char *buf, size_t len, size_t pos, s snprintf(seq,MAX_SEQ_LEN,"\x1b[0K"); term_putstr( seq, strlen( seq ) ); /* Move cursor to original position. */ - snprintf(seq,MAX_SEQ_LEN,"\x1b[0G\x1b[%dC", (int)(pos+plen)); + snprintf(seq,MAX_SEQ_LEN,"\r\x1b[%dC", (int)(pos+plen)); term_putstr( seq, strlen( seq ) ); }