diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-22 23:36:12 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-03-22 23:36:12 +0100 |
commit | 61ca92972886cd7a9bc301ae7e23d6dde74920bc (patch) | |
tree | 7b69905a86b095f4fe6dffaa5a86ae6a0725c125 /src/gui/curses | |
parent | 8c4dc57d8e5a6b1f9f239bdcbf30dd07480993be (diff) | |
download | weechat-61ca92972886cd7a9bc301ae7e23d6dde74920bc.zip |
Added tags for lines and custom filtering by tags or regex (task #7674), fixed many memory leaks
Diffstat (limited to 'src/gui/curses')
-rw-r--r-- | src/gui/curses/gui-curses-bar.c | 2 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-chat.c | 21 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-color.c | 15 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-keyboard.c | 1 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-main.c | 6 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-window.c | 2 | ||||
-rw-r--r-- | src/gui/curses/gui-curses.h | 1 |
7 files changed, 36 insertions, 12 deletions
diff --git a/src/gui/curses/gui-curses-bar.c b/src/gui/curses/gui-curses-bar.c index 2166542ad..bf167b092 100644 --- a/src/gui/curses/gui-curses-bar.c +++ b/src/gui/curses/gui-curses-bar.c @@ -352,6 +352,8 @@ gui_bar_window_draw (struct t_gui_window *window, } if (item_value2) free (item_value2); + if (items) + string_free_exploded (items); } free (item_value); } diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index 6adbb13f6..2e7375e1f 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -837,7 +837,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line, { /* display read marker if needed */ if (window->buffer->last_read_line && - (window->buffer->last_read_line == line->prev_line)) + (window->buffer->last_read_line == gui_chat_get_prev_line_displayed (line))) { gui_chat_set_weechat_color (window, GUI_COLOR_CHAT_READ_MARKER); @@ -874,7 +874,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window, /* if looking backward, start at last line of buffer */ if (backward) { - *line = window->buffer->last_line; + *line = gui_chat_get_last_line_displayed (window->buffer); if (!(*line)) return; current_size = gui_chat_display_line (window, *line, 0, 1); @@ -885,7 +885,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window, /* if looking forward, start at first line of buffer */ else { - *line = window->buffer->lines; + *line = gui_chat_get_first_line_displayed (window->buffer); if (!(*line)) return; *line_pos = 0; @@ -904,7 +904,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window, (*line_pos)--; else { - *line = (*line)->prev_line; + *line = gui_chat_get_prev_line_displayed (*line); if (*line) { current_size = gui_chat_display_line (window, *line, 0, 1); @@ -922,7 +922,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window, (*line_pos)++; else { - *line = (*line)->next_line; + *line = gui_chat_get_next_line_displayed (*line); if (*line) { current_size = gui_chat_display_line (window, *line, 0, 1); @@ -941,7 +941,7 @@ gui_chat_calculate_line_diff (struct t_gui_window *window, if (backward) { /* first line reached */ - *line = window->buffer->lines; + *line = gui_chat_get_first_line_displayed (window->buffer); *line_pos = 0; } else @@ -1158,19 +1158,19 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase) ptr_line, 0, 1) - line_pos, 0); - ptr_line = ptr_line->next_line; + ptr_line = gui_chat_get_next_line_displayed (ptr_line); ptr_win->first_line_displayed = 0; } else ptr_win->first_line_displayed = - (ptr_line == ptr_win->buffer->lines); + (ptr_line == gui_chat_get_first_line_displayed (ptr_win->buffer)); /* display lines */ count = 0; while (ptr_line && (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1)) { count = gui_chat_display_line (ptr_win, ptr_line, 0, 0); - ptr_line = ptr_line->next_line; + ptr_line = gui_chat_get_next_line_displayed (ptr_line); } old_scroll = ptr_win->scroll; @@ -1191,7 +1191,8 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase) WEECHAT_HOOK_SIGNAL_POINTER, ptr_win); } - if (!ptr_win->scroll && (ptr_win->start_line == ptr_win->buffer->lines)) + if (!ptr_win->scroll + && (ptr_win->start_line == gui_chat_get_first_line_displayed (ptr_win->buffer))) { ptr_win->start_line = NULL; ptr_win->start_line_pos = 0; diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index a642cfebf..1adb758ee 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -459,3 +459,18 @@ gui_color_init () gui_color_init_pairs (); gui_color_init_weechat (); } + +/* + * gui_color_end: end GUI colors + */ + +void +gui_color_end () +{ + int i; + + for (i = 0; i < GUI_NUM_COLORS; i++) + { + gui_color_free (gui_color[i]); + } +} diff --git a/src/gui/curses/gui-curses-keyboard.c b/src/gui/curses/gui-curses-keyboard.c index d6353a50f..62be0e4c1 100644 --- a/src/gui/curses/gui-curses-keyboard.c +++ b/src/gui/curses/gui-curses-keyboard.c @@ -135,6 +135,7 @@ gui_keyboard_default_bindings () gui_keyboard_bind (/* m-w,m-down */ "meta-wmeta-meta2-B", "/window down"); gui_keyboard_bind (/* m-w,m-left */ "meta-wmeta-meta2-D", "/window left"); gui_keyboard_bind (/* m-w,m-right */ "meta-wmeta-meta2-C", "/window right"); + gui_keyboard_bind (/* m-= */ "meta-=", "/filter toggle"); gui_keyboard_bind (/* m-0 */ "meta-0", "/buffer 10"); gui_keyboard_bind (/* m-1 */ "meta-1", "/buffer 1"); gui_keyboard_bind (/* m-2 */ "meta-2", "/buffer 2"); diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index ff459062c..bf842dfcf 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -263,8 +263,9 @@ gui_main_loop () void gui_main_end () { - /* remove bar items */ + /* remove bar items and bars */ gui_bar_item_end (); + gui_bar_free_all (); /* free clipboard buffer */ if (gui_input_clipboard) @@ -290,6 +291,9 @@ gui_main_end () if (CONFIG_BOOLEAN(config_look_set_title)) gui_window_title_reset (); + /* end color */ + gui_color_end (); + /* end of Curses output */ refresh (); endwin (); diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index a23128f10..550d2a909 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -726,7 +726,7 @@ gui_window_scroll_top (struct t_gui_window *window) if (!window->first_line_displayed) { - window->start_line = window->buffer->lines; + window->start_line = gui_chat_get_first_line_displayed (window->buffer); window->start_line_pos = 0; gui_chat_draw (window->buffer, 0); if (!window->scroll) diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h index 663b4963c..b5899ceb7 100644 --- a/src/gui/curses/gui-curses.h +++ b/src/gui/curses/gui-curses.h @@ -62,6 +62,7 @@ extern struct t_gui_color gui_weechat_colors[]; /* color functions */ extern int gui_color_get_pair (int num_color); extern void gui_color_init (); +extern void gui_color_end (); /* bar functions */ extern void gui_bar_window_calculate_pos_size (struct t_gui_bar_window *bar_window, |