tsm: screen: introduce scrollback-buffer line IDs
If we have pointers somewhere into the scrollback-buffer, there is not easy way to see which of two lines comes first. Therefore, we introduce scrollback buffer IDs. These are unique and every line gets one assigned when it is linked into the sb-buffer. These IDs guarantee that front lines have lower IDs than bottom lines. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
e2f614ab1a
commit
1f11f8c961
@ -54,6 +54,7 @@ struct line {
|
||||
|
||||
unsigned int size;
|
||||
struct cell *cells;
|
||||
uint64_t sb_id;
|
||||
};
|
||||
|
||||
struct tsm_screen {
|
||||
@ -80,6 +81,7 @@ struct tsm_screen {
|
||||
struct line *sb_last; /* last line; was moved last*/
|
||||
unsigned int sb_max; /* max-limit of lines in sb */
|
||||
struct line *sb_pos; /* current position in sb or NULL */
|
||||
uint64_t sb_last_id; /* last id given to sb-line */
|
||||
|
||||
/* cursor */
|
||||
unsigned int cursor_x;
|
||||
@ -197,6 +199,7 @@ static void link_to_scrollback(struct tsm_screen *con, struct line *line)
|
||||
line_free(tmp);
|
||||
}
|
||||
|
||||
line->sb_id = ++con->sb_last_id;
|
||||
line->next = NULL;
|
||||
line->prev = con->sb_last;
|
||||
if (con->sb_last)
|
||||
|
Loading…
x
Reference in New Issue
Block a user