aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-28 21:03:43 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-28 21:03:43 +0000
commit78ff8197cc5ff8a9b207b0c27a96a292d1f492cc (patch)
tree3eda1bf954284ae8daaa51b836e62b831e117a2e /libbb/lineedit.c
parent86d88c09909b1089bd2b43e896895c48ce33f1b2 (diff)
downloadbusybox-78ff8197cc5ff8a9b207b0c27a96a292d1f492cc.tar.gz
lineedit: document prompt handling
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 42f372fb9..3ef47ba71 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -15,17 +15,23 @@
*/
/*
- Usage and known bugs:
- Terminal key codes are not extensive, and more will probably
- need to be added. This version was created on Debian GNU/Linux 2.x.
- Delete, Backspace, Home, End, and the arrow keys were tested
- to work in an Xterm and console. Ctrl-A also works as Home.
- Ctrl-E also works as End.
-
- Small bugs (simple effect):
- - not true viewing if terminal size (x*y symbols) less
- size (prompt + editor's line + 2 symbols)
- - not true viewing if length prompt less terminal width
+ * Usage and known bugs:
+ * Terminal key codes are not extensive, and more will probably
+ * need to be added. This version was created on Debian GNU/Linux 2.x.
+ * Delete, Backspace, Home, End, and the arrow keys were tested
+ * to work in an Xterm and console. Ctrl-A also works as Home.
+ * Ctrl-E also works as End.
+ *
+ * lineedit does not know that the terminal escape sequences do not
+ * take up space on the screen. The redisplay code assumes, unless
+ * told otherwise, that each character in the prompt is a printable
+ * character that takes up one character position on the screen.
+ * You need to tell lineedit that some sequences of characters
+ * in the prompt take up no screen space. Compatibly with readline,
+ * use the \[ escape to begin a sequence of non-printing characters,
+ * and the \] escape to signal the end of such a sequence. Example:
+ *
+ * PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
*/
#include "libbb.h"