aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/linenoise.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/linenoise.hpp b/src/linenoise.hpp
index b680141..06add16 100644
--- a/src/linenoise.hpp
+++ b/src/linenoise.hpp
@@ -1867,11 +1867,14 @@ inline void refreshSingleLine(struct linenoiseState *l) {
1867 /* Erase to right */ 1867 /* Erase to right */
1868 snprintf(seq,64,"\x1b[0K"); 1868 snprintf(seq,64,"\x1b[0K");
1869 ab += seq; 1869 ab += seq;
1870 if (!l->prompt.empty() || len != 0) { 1870 int newPos = unicodeColumnPos(buf, pos) + pcolwid;
1871 /* Move cursor to original position. */ 1871 /* Move cursor to original position. */
1872 snprintf(seq,64,"\r\x1b[%dC", (int)(unicodeColumnPos(buf, pos)+pcolwid)); 1872 if (newPos != 0) {
1873 ab += seq; 1873 snprintf(seq,64,"\r\x1b[%dC", newPos);
1874 } else {
1875 snprintf(seq,64,"\r");
1874 } 1876 }
1877 ab += seq;
1875 if (write(fd,ab.c_str(), static_cast<int>(ab.length())) == -1) {} /* Can't recover from write error. */ 1878 if (write(fd,ab.c_str(), static_cast<int>(ab.length())) == -1) {} /* Can't recover from write error. */
1876} 1879}
1877 1880