Remove direct access to buf.lines

Cursor now uses methods on buffer to manipulate the buffer. This makes
more caching possible. This fixes some syntax highlighting
inefficiencies.