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)