diff options
Diffstat (limited to 'src/linenoise.hpp')
-rw-r--r-- | src/linenoise.hpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/linenoise.hpp b/src/linenoise.hpp index 923a006..b680141 100644 --- a/src/linenoise.hpp +++ b/src/linenoise.hpp | |||
@@ -1864,13 +1864,14 @@ inline void refreshSingleLine(struct linenoiseState *l) { | |||
1864 | /* Write the prompt and the current buffer content */ | 1864 | /* Write the prompt and the current buffer content */ |
1865 | ab += l->prompt; | 1865 | ab += l->prompt; |
1866 | ab.append(buf, len); | 1866 | ab.append(buf, len); |
1867 | if (ab.empty()) return; | ||
1868 | /* Erase to right */ | 1867 | /* Erase to right */ |
1869 | snprintf(seq,64,"\x1b[0K"); | 1868 | snprintf(seq,64,"\x1b[0K"); |
1870 | ab += seq; | 1869 | ab += seq; |
1871 | /* Move cursor to original position. */ | 1870 | if (!l->prompt.empty() || len != 0) { |
1872 | snprintf(seq,64,"\r\x1b[%dC", (int)(unicodeColumnPos(buf, pos)+pcolwid)); | 1871 | /* Move cursor to original position. */ |
1873 | ab += seq; | 1872 | snprintf(seq,64,"\r\x1b[%dC", (int)(unicodeColumnPos(buf, pos)+pcolwid)); |
1873 | ab += seq; | ||
1874 | } | ||
1874 | if (write(fd,ab.c_str(), static_cast<int>(ab.length())) == -1) {} /* Can't recover from write error. */ | 1875 | if (write(fd,ab.c_str(), static_cast<int>(ab.length())) == -1) {} /* Can't recover from write error. */ |
1875 | } | 1876 | } |
1876 | 1877 | ||