mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
update line cache on switching wcwidth implementation
This commit is contained in:
parent
3ef0b9b3d0
commit
b2a429bfb4
@ -123,7 +123,7 @@ void wcwidth_wrapper_init(void)
|
||||
#endif
|
||||
|
||||
read_settings();
|
||||
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
signal_add_first("setup changed", (SIGNAL_FUNC) read_settings);
|
||||
}
|
||||
|
||||
void wcwidth_wrapper_deinit(void)
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "gui-printtext.h"
|
||||
|
||||
static int window_create_override;
|
||||
int wcwidth_impl;
|
||||
|
||||
static GUI_WINDOW_REC *gui_window_init(WINDOW_REC *window,
|
||||
MAIN_WINDOW_REC *parent)
|
||||
@ -51,6 +52,7 @@ static GUI_WINDOW_REC *gui_window_init(WINDOW_REC *window,
|
||||
!settings_get_bool("indent_always"),
|
||||
get_default_indent_func());
|
||||
textbuffer_view_set_break_wide(gui->view, settings_get_bool("break_wide"));
|
||||
wcwidth_impl = settings_get_choice("wcwidth_implementation");
|
||||
textbuffer_view_set_hidden_level(gui->view, MSGLEVEL_HIDDEN);
|
||||
if (parent->active == window)
|
||||
textbuffer_view_set_window(gui->view, parent->screen_win);
|
||||
@ -202,11 +204,17 @@ void gui_window_reparent(WINDOW_REC *window, MAIN_WINDOW_REC *parent)
|
||||
void gui_windows_reset_settings(void)
|
||||
{
|
||||
GSList *tmp;
|
||||
int old_wcwidth_impl = wcwidth_impl;
|
||||
wcwidth_impl = settings_get_choice("wcwidth_implementation");
|
||||
|
||||
for (tmp = windows; tmp != NULL; tmp = tmp->next) {
|
||||
WINDOW_REC *rec = tmp->data;
|
||||
GUI_WINDOW_REC *gui = WINDOW_GUI(rec);
|
||||
|
||||
if (old_wcwidth_impl != wcwidth_impl) {
|
||||
textbuffer_view_reset_cache(gui->view);
|
||||
}
|
||||
|
||||
textbuffer_view_set_break_wide(gui->view, settings_get_bool("break_wide"));
|
||||
|
||||
textbuffer_view_set_default_indent(gui->view,
|
||||
@ -217,6 +225,10 @@ void gui_windows_reset_settings(void)
|
||||
textbuffer_view_set_scroll(gui->view,
|
||||
gui->use_scroll ? gui->scroll :
|
||||
settings_get_bool("scroll"));
|
||||
|
||||
if (old_wcwidth_impl != wcwidth_impl) {
|
||||
textbuffer_view_redraw(gui->view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,7 +374,7 @@ static void view_update_cache(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
|
||||
view->cache->last_linecount = view_get_linecount(view, line);
|
||||
}
|
||||
|
||||
static void view_reset_cache(TEXT_BUFFER_VIEW_REC *view)
|
||||
void textbuffer_view_reset_cache(TEXT_BUFFER_VIEW_REC *view)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
@ -691,7 +691,7 @@ void textbuffer_view_set_break_wide(TEXT_BUFFER_VIEW_REC *view,
|
||||
{
|
||||
if (view->break_wide != break_wide) {
|
||||
view->break_wide = break_wide;
|
||||
view_reset_cache(view);
|
||||
textbuffer_view_reset_cache(view);
|
||||
}
|
||||
}
|
||||
|
||||
@ -703,7 +703,7 @@ static void view_unregister_indent_func(TEXT_BUFFER_VIEW_REC *view,
|
||||
|
||||
/* recreate cache so it won't contain references
|
||||
to the indent function */
|
||||
view_reset_cache(view);
|
||||
textbuffer_view_reset_cache(view);
|
||||
view->cache = textbuffer_cache_get(view->siblings, view->width);
|
||||
}
|
||||
|
||||
@ -1314,7 +1314,7 @@ void textbuffer_view_remove_all_lines(TEXT_BUFFER_VIEW_REC *view)
|
||||
g_hash_table_foreach_remove(view->bookmarks,
|
||||
(GHRFunc) g_free_true, NULL);
|
||||
|
||||
view_reset_cache(view);
|
||||
textbuffer_view_reset_cache(view);
|
||||
textbuffer_view_clear(view);
|
||||
g_slist_foreach(view->siblings, (GFunc) textbuffer_view_clear, NULL);
|
||||
}
|
||||
|
@ -129,6 +129,8 @@ void textbuffer_view_scroll_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line);
|
||||
/* Return line cache */
|
||||
LINE_CACHE_REC *textbuffer_view_get_line_cache(TEXT_BUFFER_VIEW_REC *view,
|
||||
LINE_REC *line);
|
||||
/* Reset the whole line cache */
|
||||
void textbuffer_view_reset_cache(TEXT_BUFFER_VIEW_REC *view);
|
||||
|
||||
/*
|
||||
Functions for manipulating the text buffer, using these commands update
|
||||
|
Loading…
Reference in New Issue
Block a user