From 5776ca5e0bb36574974f39d52c4c8e19ff686bb1 Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sun, 13 Oct 2019 21:35:30 +0200 Subject: [PATCH] bottom_startline lost? --- src/fe-text/textbuffer-view.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c index a031439d..45035fa8 100644 --- a/src/fe-text/textbuffer-view.c +++ b/src/fe-text/textbuffer-view.c @@ -1205,14 +1205,14 @@ static void view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line, LINE_REC *prevline; prevline = view->buffer->first_line == line ? NULL : - textbuffer_line_last(view->buffer); + textbuffer_line_last(view->buffer)->prev; view->cache->last_linecount = prevline == NULL ? 0 : view_get_linecount(view, prevline); } + /* first line in the buffer - this is the most commonly + removed line.. */ if (view->buffer->first_line == line) { - /* first line in the buffer - this is the most commonly - removed line.. */ if (view->bottom_startline == line) { /* very small scrollback.. */ view->bottom_startline = view->bottom_startline->next; @@ -1289,6 +1289,11 @@ void textbuffer_view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line) } textbuffer_remove(view->buffer, line); + if (view->bottom_startline == NULL) { + /* We may have removed the bottom_startline, make sure + that scroll doesn't get stuck */ + textbuffer_view_init_bottom(view); + } } void textbuffer_view_remove_lines_by_level(TEXT_BUFFER_VIEW_REC *view, int level)