diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c index 7d007e40..ee474785 100644 --- a/src/fe-text/textbuffer-view.c +++ b/src/fe-text/textbuffer-view.c @@ -394,10 +394,9 @@ view_update_line_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line) if (rec->count > 1) { for (pos = 0; lines != NULL; pos++) { - void *data = lines->data; + LINE_CACHE_SUB_REC *data = lines->data; - memcpy(&rec->lines[pos], data, - sizeof(LINE_CACHE_SUB_REC)); + memcpy(&rec->lines[pos], data, sizeof(LINE_CACHE_SUB_REC)); lines = g_slist_remove(lines, data); g_free(data); @@ -430,7 +429,7 @@ static void view_update_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line, view_remove_cache(view, line, update_counter); if (view->buffer->cur_line == line) - view->cache->last_linecount = view_get_linecount(view, line); + view_get_linecount(view, line); } void textbuffer_view_reset_cache(TEXT_BUFFER_VIEW_REC *view) @@ -459,6 +458,7 @@ static int view_line_draw(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line, unichar chr; int xpos, color, drawcount, first, need_move, need_clrtoeol, char_width; unsigned int fg24, bg24; + fg24 = bg24 = UINT_MAX; if (view->dirty) /* don't bother drawing anything - redraw is coming */ return 0; @@ -757,7 +757,6 @@ static void view_unregister_indent_func(TEXT_BUFFER_VIEW_REC *view, /* recreate cache so it won't contain references to the indent function */ textbuffer_view_reset_cache(view); - view->cache = textbuffer_cache_get(view->siblings, view->width); } void textbuffer_views_unregister_indent_func(INDENT_FUNC indent_func) @@ -1073,10 +1072,10 @@ LINE_CACHE_REC *textbuffer_view_get_line_cache(TEXT_BUFFER_VIEW_REC *view, cache = g_hash_table_lookup(view->cache->line_cache, line); if (cache == NULL) cache = view_update_line_cache(view, line); - else + else cache->last_access = time(NULL); - return cache; + return cache; } static void view_insert_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line) @@ -1257,12 +1256,13 @@ static void view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line, view_bookmarks_check(view, line); if (view->buffer->cur_line == line) { - /* the last line is being removed */ + /* the last line is being removed */ LINE_REC *prevline; - prevline = view->buffer->first_line == line ? NULL : - textbuffer_line_last(view->buffer)->prev; - view->cache->last_linecount = prevline == NULL ? 0 : + prevline = view->buffer->first_line == line ? + NULL : + textbuffer_line_last(view->buffer)->prev; + if (prevline != NULL) view_get_linecount(view, prevline); }