summaryrefslogtreecommitdiff
path: root/third_party
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2011-04-11 19:27:19 -0400
committerMathias Stearn <mathias@10gen.com>2011-04-11 19:27:19 -0400
commit220d4139069d5eed73a457a0c1f22463c9e660d1 (patch)
treebcda464f32b61d7b39c159749212defed7a66223 /third_party
parentae79f44dd289e67b5b68adf931312e96c2dd2e2d (diff)
downloadmongo-220d4139069d5eed73a457a0c1f22463c9e660d1.tar.gz
CHA is 1-based. Fixes an issue with aterm.
Diffstat (limited to 'third_party')
-rw-r--r--third_party/linenoise/linenoise.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/third_party/linenoise/linenoise.cpp b/third_party/linenoise/linenoise.cpp
index 70fdbaf7137..bd0f36af633 100644
--- a/third_party/linenoise/linenoise.cpp
+++ b/third_party/linenoise/linenoise.cpp
@@ -56,8 +56,8 @@
* the more compatible.
*
* CHA (Cursor Horizontal Absolute)
- * Sequence: ESC [ n G
- * Effect: moves cursor to column n
+ * Sequence: ESC [ 1 G
+ * Effect: moves cursor to column n (1 based)
*
* EL (Erase Line)
* Sequence: ESC [ n K
@@ -268,7 +268,7 @@ static void refreshLine(int fd, const char *prompt, char *buf, size_t len, size_
{
char seq[64];
/* Cursor to left edge */
- snprintf(seq,64,"\x1b[0G");
+ snprintf(seq,64,"\x1b[1G");
if (write(fd,seq,strlen(seq)) == -1) return;
/* Write the prompt and the current buffer content */
if (write(fd,prompt,strlen(prompt)) == -1) return;
@@ -277,7 +277,7 @@ static void refreshLine(int fd, const char *prompt, char *buf, size_t len, size_
snprintf(seq,64,"\x1b[0K");
if (write(fd,seq,strlen(seq)) == -1) return;
/* Move cursor to original position. */
- snprintf(seq,64,"\x1b[0G\x1b[%dC", (int)(pos+plen));
+ snprintf(seq,64,"\x1b[1G\x1b[%dC", (int)(pos+plen));
if (write(fd,seq,strlen(seq)) == -1) return;
}
#endif