wip: initial scroll back support

Can scroll up and down, and stops when the beginning/end of history is
reached.

However, it probably breaks when the entire scrollback buffer has been
filled - we need to detect when the view has wrapped around to the
current terminal offset.

The detection of when we've reached the bottom of the history is also
flawed, and only works when we overshoot the bottom with at least a
page.

Resizing the windows while in a view most likely doesn't work.

The view will not detect a wrapped around scrollback buffer. I.e. if
the user has scrolled back, and is stationary at a view, but there is
still output being produced. Then eventually the scrollback buffer
will wrap around. In this case, the correct thing to do is make the
view start following the beginning of the history. Right now it
doesn't, meaning once the scrollback buffer wraps around, you'll start
seeing command output...
This commit is contained in:
Daniel Eklöf 2019-07-09 16:26:36 +02:00
parent 34f9d544fd
commit bcd111d203
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
8 changed files with 146 additions and 8 deletions

7
grid.h
View file

@ -10,6 +10,13 @@ grid_row(struct grid *grid, int row)
return grid->rows[(grid->offset + row + grid->num_rows) % grid->num_rows];
}
static inline struct row *
grid_row_in_view(struct grid *grid, int row)
{
assert(grid->view >= 0);
return grid->rows[(grid->view + row + grid->num_rows) % grid->num_rows];
}
static inline void
grid_swap_row(struct grid *grid, int row_a, int row_b)
{