Rewrite buffer and cursor modules

Buffer now uses DList from the std lib to store all lines.
Cursor no longer contains a reference to the current line, rather just x
and y coordinates which are used to position it in the buffer.

Hopefully this works better than previous attempts.