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