elua/elua

shell is not compatible with vt100

Closed this issue · 2 comments

"\x1b[0G" sequence is not supported by vt100
probably it will be better use "\r" instead (tested in minicom in Ubuntu)

diff --git a/src/linenoise.c b/src/linenoise.c
index fb41583..77c9e1f 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 ) );
 }

Thanks for the report! Could you please create a pull request for this? If not, I can merge it by hand.

also i have ported vi from busybox as shell command, is it interesting to you?