Add "emacs" to unsupported_term

The Emacs terminal emulator has its own line editing and does not
behave correctly in raw mode. Without this programs using linenoise
will hang when run inside an Emacs shell.
fix linenoiseEdit buflen decreasing.
use const char * when modification isn't necessary
fix incorrect type caused issue on 64bit powerpc

Signed-off-by: Insop Song <insop.song@gainspeed.com>
Merge pull request #53 from insop/master

fix incorrect type caused issue on 64bit powerpc
Refresh line with single write to avoid flickering.

Escape sequences and actual content to write to the terminal is now
accumulated into an heap allocated buffer that is flushed with a single
write at the end. This avoids a flickering effect making linenoise more
professional looking ;-)
Handle malloc error in linenoiseAddCompletion().

We just don't add the entry on out of memory to avoid to
break the API with previous versions of Linenoise.
Merge branch 'master' of git://github.com/antirez/linenoise
Debugging code cleanup.
Add the key enumeration
Don't assume STDIN_FD and STDOUT_FD are interchangeable.
Merge pull request #51 from MartinNowak/const

use const char * when modification isn't necessary
Merge pull request #49 from polch/master_fixes

fix linenoiseEdit buflen decreasing.
Merge pull request #48 from nickg/emacs

Add "emacs" to unsupported_term
Add extern "C" around linenoise.h when compiled as C++
Merge branch 'master' of github.com:/antirez/linenoise
Fix escape sequence processing when only one byte available

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.
Arrow scancodes replaced with enums in linenoiseEdit().
Use the two-reads fix for the additional escapes as well.

See commit e153bd8 for more information.
The gist is that slow terminals may return a short read of 1 byte.
Scan codes debugging functionality.

./linenoise_example --scancodes