diff options
author | Li Jin <dragon-fly@qq.com> | 2020-04-03 16:32:43 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-04-03 16:32:43 +0800 |
commit | 36e3cb3b98b5686ae8a96b92a45277f8977e71d7 (patch) | |
tree | 1cacd2982cca8432d1e2f50dc243ba6d51cd0b1f /src | |
parent | 1c4c3159374a5c4b08a06ca8e3e7f49442edd59c (diff) | |
download | yuescript-36e3cb3b98b5686ae8a96b92a45277f8977e71d7.tar.gz yuescript-36e3cb3b98b5686ae8a96b92a45277f8977e71d7.tar.bz2 yuescript-36e3cb3b98b5686ae8a96b92a45277f8977e71d7.zip |
fix moonp repl editing issue.
Diffstat (limited to 'src')
-rw-r--r-- | src/linenoise.hpp | 11 |
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 | ||