From 1f11f8c961beff3b95a10ea5afa3af0e5b5f6c69 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 5 Oct 2012 13:24:58 +0200 Subject: [PATCH] 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 --- src/tsm_screen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tsm_screen.c b/src/tsm_screen.c index cce6e57..fa91932 100644 --- a/src/tsm_screen.c +++ b/src/tsm_screen.c @@ -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) -- 2.7.4