console: add margin support
authorDavid Herrmann <dh.herrmann@googlemail.com>
Fri, 3 Feb 2012 16:16:50 +0000 (17:16 +0100)
committerDavid Herrmann <dh.herrmann@googlemail.com>
Fri, 3 Feb 2012 16:47:46 +0000 (17:47 +0100)
commitcd62b330be0316d17bff96580402b2d6a9c7c0be
tree4828709c46a5212e5db919866ff8a722c9d0d7ed
parentc4a4e796e77bd336dfdef1aa5be6eabe4818720b
console: add margin support

Margins are a method to stick lines to the top and bottom of a buffer
and ignore them during console-rotations. We keep 3 different buffers,
two static buffers for the top and bottom margin and one buffer for the
scroll region. The scroll region is always big enough to hold all three
buffers even though it does not contain them. This allows us to merge
the margins back to the scroll-buffer very fast without reallocations.

The buffer layout is the top-margin at the top. The scroll region is
below and the bottom margin is at the bottom. If we rotate the buffer,
we do not touch the margins but simply rotate the scroll buffer. This
may corrupt the scroll-back buffer but there is no sane way to implement
this. The original VTs did not support this either.

Even though we have multiple buffers we keep the buffer-fill logic. That
is, the scroll buffer is not always fully filled. However, if we merge
back the bottom buffer to the scroll buffer, we set the scroll buffer to
be fully filled. Otherwise, we would have artifacts at the bottom.
The top margin does not show this behavior as it is not affected by
rotations below the fill-line.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
src/console_cell.c