Skip to content
Commits on Apr 13, 2016
  1. Clear hints after newline.

    committed Apr 13, 2016
Commits on Apr 12, 2016
  1. Linenoise API documented.

    committed Apr 12, 2016
  2. linenoiseFree() API introduced.

    committed Apr 12, 2016
  3. Hints WIP

    committed Apr 12, 2016
Commits on Apr 6, 2016
  1. Copyright info updated.

    committed Apr 6, 2016
Commits on Jul 13, 2015
Commits on Apr 13, 2015
  1. Version 1.0

    committed Apr 13, 2015
    Linenoise is used in multiple projects for enough time, let's tag this
    commit with a version number as requested into issue #88, so that we
    have an initial reference.
    
    Given the nature of the library, the version was also added in the
    linenoise C and header file as well so that it is easy to realize for
    people having a copy embedded somewhere if they are using the latest
    version.
Commits on Oct 7, 2014
  1. License file added.

    committed Oct 7, 2014
    However the files linenose.c and linenose.h already had inline licenses.
Commits on Sep 3, 2014
  1. Move to end before return when in multi-line mode.

    committed Sep 3, 2014
    This makes sure that if we are editing in multi-line mode a line that
    actually spawns across multiple lines, the next output performed by the
    application using linenoise will not overwrite the edited line.
  2. Replace ESC 999D with CR.

    committed Sep 3, 2014
    OSX default Terminal app does not handle 999D well, the cursor will wrap
    back to the previous row in the last colum, instead of ignoring the
    sequence if the cursor is already at the left edge.
    
    In order to avoid reintroducing the nG sequence that is not compatible
    with base VT100 emulation and ANSI.SYS, we use CR that should be
    hopefully widely supported.
  3. Don't emit ESC [ n C with n=0.

    committed Sep 3, 2014
    This fixes a bug introduced with ANSI.SYS compatibility.
    When we want to move at a specific column, we need to emit the sequence
    to move the cursor to the right (after we moved 999 positions to the left)
    only if we want to actually move right at least 1 position, since a
    count of zero will still move the cursor one position to the right.
  4. Avoid CHA sequence for ANSI.SYS compatibility.

    committed Sep 3, 2014
    Github user @welash proposed a change in issue #73 in order to improve
    the linenoise compatibility with older terminal emulators only able to
    deal with a subset of ANSI sequences, notably ANSI.SYS and VT100
    terminals strictly able to handle the original set of VT100 escape
    sequences.
    
    In order to improve the compatibility, the CHA sequence was removed and
    translated to move 999 positions to the left, then move on the right
    for the desired number of positions. The CHA sequence was apparently
    added only with VT220, that's why it is not available everywhere.
    
    This commit features almost exactly the change proposed in issue #73
    with a small fix for a bug in multi-line editing mode introduced by the
    patch.
Commits on Sep 2, 2014
Commits on Apr 18, 2014
  1. Multi line editing is no longer experimental.

    committed Apr 18, 2014
    It is now the default in the Redis command line interface so it is
    used by many users every day.
  2. Linenoise is now ~ 1100 lines of code ;-)

    committed Apr 18, 2014
    Fixes issue #63.
Commits on Mar 13, 2014
  1. Support for Home / End keys.

    committed Mar 13, 2014
    Some terminal reports ESC [H and ESC [F, while some other reports
    ESC OH and ESC OF. We support both but there is at least another
    variant documented, hopefully no longer.
  2. Fix right arrow handling.

    committed Mar 13, 2014
    Bug introduced in recent refactoring.
  3. If ioctl() fails get num of columns querying the terminal.

    committed Mar 13, 2014
    This change makes linenoise both more robust if the ioctl() fails, and
    far more portable to non POSIX systems, since the ioclt() to query the
    terminal was probably one of the non trivial parts to replace.
    
    The code is inspired to Andreas Kupries commit 24186e9 on the win32
    Linenoise port from Steve Bennett, but is a complete reimplementation.
  4. Compare human readable key codes with chars literals.

    committed Mar 13, 2014
    Many sequences are actually human readable and fall into the printable
    ASCII subset, they are a lot more recognizable when written as chars
    compared to numbers.
    
    For example up arrow is sent back from the terimal as ESC [A, and so
    forth.
    
    This commit makes the code speak the same "language" that you find in
    any terminal escape sequences documentation.
  5. Rename Scan codes -> Key codes.

    committed Mar 13, 2014
    What we print in debug mode using the option (now) called --keycodes
    are not the scan codes, but the key codes returned by the terminal (a
    more higher level representation of the keys pressed).
    
    This commit fixes the word used.
Commits on Mar 12, 2014
  1. Scan codes debugging functionality.

    committed Mar 12, 2014
    ./linenoise_example --scancodes
  2. Use the two-reads fix for the additional escapes as well.

    committed Mar 12, 2014
    See commit e153bd8 for more information.
    The gist is that slow terminals may return a short read of 1 byte.
  3. Fix escape sequence processing when only one byte available

    Nick Gasson committed with Jan 6, 2014
    The read call in the escape sequence processing does not
    handle the case where only the first byte is available. This can
    happen for example on a slow serial terminal.
    
    Comment by @antirez:
    
    I reworked the code for brevity, for historical reasons here is the
    proposed patch. I believe my fix should be functionally equivalent.
    
    Original fix:
    
                 case 27:    /* escape sequence */
                     /* Read the next two bytes representing the
                        escape sequence. */
        -            if (read(fd,seq,2) == -1) break;
        +            {
        +                ssize_t b = read(fd, seq, 2);
        +
        +                if (b < 0) break;
        +
        +                if (b == 1) {
        +                    b = read(fd,&seq[1], 1);
        +                    if (b != 1) {
        +                        break;
        +                    }
        +                }
        +            }
    
    See PR #47.
Something went wrong with that request. Please try again.