From b9a83129fe65d6d81d0ef82d5bf7814018700a8d Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 8 Aug 2001 15:43:07 +0000 Subject: [PATCH] Some extra cleanups for /SB CLEAR. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1719 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/textbuffer-view.c | 9 +++++++++ src/fe-text/textbuffer.c | 1 + 2 files changed, 10 insertions(+) diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c index aa9f5c2b..37434f55 100644 --- a/src/fe-text/textbuffer-view.c +++ b/src/fe-text/textbuffer-view.c @@ -966,6 +966,12 @@ void textbuffer_view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line) textbuffer_remove(view->buffer, line); } +static int g_free_true(void *data) +{ + g_free(data); + return TRUE; +} + /* Remove all lines from buffer. */ void textbuffer_view_remove_all_lines(TEXT_BUFFER_VIEW_REC *view) { @@ -975,6 +981,9 @@ void textbuffer_view_remove_all_lines(TEXT_BUFFER_VIEW_REC *view) textbuffer_remove_all_lines(view->buffer); + g_hash_table_foreach_remove(view->bookmarks, + (GHRFunc) g_free_true, NULL); + /* destroy line caches - note that you can't do simultaneously unrefs + cache_get()s or it will keep using the old caches */ textbuffer_cache_unref(view->cache); diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c index 105e192a..743cd2a2 100644 --- a/src/fe-text/textbuffer.c +++ b/src/fe-text/textbuffer.c @@ -333,6 +333,7 @@ void textbuffer_remove_all_lines(TEXT_BUFFER_REC *buffer) buffer->cur_line = NULL; buffer->lines_count = 0; + buffer->last_eol = TRUE; } void textbuffer_line2text(LINE_REC *line, int coloring, GString *str)