added support for HOME and END keys and prevent duplicate consecutive lines,
originally the patch is from Dvir Volk, see https://github.com/antirez/linenoise/pull/21

also added ctrl-r search for linenoise,
originally the patch is from Jalil Karimov, see https://github.com/antirez/linenoise/pull/29
I changed it starting from last line, also added Windows support for ctrl-r