Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More internals documentation

  • Loading branch information...
commit acdf9c7dd02a6d96bab028d154d7df094aecadf2 1 parent 353828e
@antirez authored
Showing with 23 additions and 11 deletions.
  1. +23 −11 linenoise.c
View
34 linenoise.c
@@ -1,6 +1,10 @@
/* linenoise.c -- guerrilla line editing library against the idea that a
* line editing lib needs to be 20,000 lines of C code.
*
+ * You can find the latest source code at:
+ *
+ * http://github.com/antirez/linenoise
+ *
* Does a number of crazy assumptions that happen to be true in 99.9999% of
* the 2010 UNIX computers around.
*
@@ -35,21 +39,29 @@
* - http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
* - http://www.3waylabs.com/nw/WWW/products/wizcon/vt220.html
*
- * Works with:
- *
- * Linux console (TERM = Linux)
- * Linux KDE terminal application (TERM = xterm)
- * Linux xterm (TERM = xterm)
- * Mac OS X iTerm (TERM = xterm)
+ * Todo list:
+ * - Switch to gets() if $TERM is something we can't support.
+ * - Completion?
*
- * Broken with:
+ * List of escape sequences used by this program, we do everything just
+ * with three sequences. In order to be so cheap we may have some
+ * flickering effect with some slow terminal, but the lesser sequences
+ * the more compatible.
*
- * Mac OS X default Terminal application (TERM = xterm)
+ * CHA (Cursor Horizontal Absolute)
+ * Sequence: ESC [ n G
+ * Effect: moves cursor to column n
*
- * TODO
+ * EL (Erase Line)
+ * Sequence: ESC [ n K
+ * Effect: if n is 0 or missing, clear from cursor to end of line
+ * Effect: if n is 1, clear from beginning of line to cursor
+ * Effect: if n is 2, clear entire line
*
- * - Switch to gets() if $TERM is something we can't support.
- * - Completion?
+ * CUF (CUrsor Forward)
+ * Sequence: ESC [ n C
+ * Effect: moves cursor forward of n chars
+ *
*/
#include <termios.h>
Please sign in to comment.
Something went wrong with that request. Please try again.