Changing line rendering so they are rendered into a persistant buffer

Before lines were rendered directly to a temporary buffer and then
printed on the screen. This changes it so instead a persistant buffer of
lines is kept and displayed/updated when nessisary.
Fix memory leak in link.c

Note: This doesn't fix the issue, but simply prevents it from creating a
memory leak. The parseTitle callback is called more the once on some titles,
resulting in a leak unless they are freed first.