Support saving file:/// URIs

The editor_save() function expected a normal filesystem path, but we're dealing
with URIs now.  The path is retrieved by skipping the first 7 characters of the
URI.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Initialize variable to prevent invalid free

A local pointer variable was not being set to NULL before a potential function
cleanup.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Simplify repaint logic

Instead of using pipes and select(), we simply call XClearArea from a different
thread.  This seems to work fine in recent versions of libX11.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
reader: Treat empty files as UTF-8

UTF-8 seems to be becoming the standard interchange encoding.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>
Switch to newly created tabs

This behavior is consistent with web browsers; Ctrl-T creates and opens a new tab.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>