diff options
author | Timo Sirainen <cras@irssi.org> | 2001-11-18 22:17:31 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-11-18 22:17:31 +0000 |
commit | 18bc86bfe7a6136f93d73734ba9c7a4a38aa6b83 (patch) | |
tree | 16c7c72badf6f83bfea453a1409a7e4680dfd779 | |
parent | 99120dc50803c8537c50cabc9289179ae4b1d39d (diff) | |
download | irssi-18bc86bfe7a6136f93d73734ba9c7a4a38aa6b83.zip |
--more-- works again, better than ever :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2066 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/fe-text/statusbar-items.c | 31 | ||||
-rw-r--r-- | src/fe-text/textbuffer-view.c | 8 | ||||
-rw-r--r-- | src/fe-text/textbuffer-view.h | 2 |
3 files changed, 39 insertions, 2 deletions
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index e6f23797..791f8708 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -25,6 +25,7 @@ #include "themes.h" #include "statusbar.h" #include "gui-entry.h" +#include "gui-windows.h" /* how often to redraw lagging time (seconds) */ #define LAG_REFRESH_TIME 10 @@ -33,9 +34,8 @@ the lag */ #define MAX_LAG_UNKNOWN_TIME 30 -/* activity */ static GList *activity_list; - +static int more_visible; static GHashTable *input_entries; static void item_window_active(SBAR_ITEM_REC *item, int get_size_only) @@ -270,6 +270,20 @@ static void sig_statusbar_activity_updated(void) static void item_more(SBAR_ITEM_REC *item, int get_size_only) { + more_visible = WINDOW_GUI(active_win)->view->more_text; + if (!more_visible) { + if (get_size_only) + item->min_size = item->max_size = 0; + return; + } + + statusbar_item_default_handler(item, get_size_only, NULL, "", FALSE); +} + +static void sig_statusbar_more_updated(void) +{ + if (WINDOW_GUI(active_win)->view->more_text != more_visible) + statusbar_items_redraw("more"); } static void item_input(SBAR_ITEM_REC *item, int get_size_only) @@ -328,6 +342,13 @@ void statusbar_items_init(void) signal_add("window destroyed", (SIGNAL_FUNC) sig_statusbar_activity_window_destroyed); signal_add("window refnum changed", (SIGNAL_FUNC) sig_statusbar_activity_updated); + more_visible = FALSE; + signal_add("gui page scrolled", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_add("window changed", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_add_last("gui print text finished", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_add_last("command clear", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_add_last("command scrollback", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_add("statusbar item destroyed", (SIGNAL_FUNC) sig_statusbar_item_destroyed); } @@ -339,6 +360,12 @@ void statusbar_items_deinit(void) signal_remove("window destroyed", (SIGNAL_FUNC) sig_statusbar_activity_window_destroyed); signal_remove("window refnum changed", (SIGNAL_FUNC) sig_statusbar_activity_updated); + signal_remove("gui page scrolled", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_remove("window changed", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_remove("gui print text finished", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_remove("command clear", (SIGNAL_FUNC) sig_statusbar_more_updated); + signal_remove("command scrollback", (SIGNAL_FUNC) sig_statusbar_more_updated); + g_list_free(activity_list); activity_list = NULL; diff --git a/src/fe-text/textbuffer-view.c b/src/fe-text/textbuffer-view.c index 748fd8d6..3eec4768 100644 --- a/src/fe-text/textbuffer-view.c +++ b/src/fe-text/textbuffer-view.c @@ -795,6 +795,7 @@ void textbuffer_view_resize(TEXT_BUFFER_VIEW_REC *view, int width, int height) view->subline; if (view->empty_linecount < view->height-linecount) view->empty_linecount = view->height-linecount; + view->more_text = FALSE; } view->dirty = TRUE; @@ -813,6 +814,7 @@ void textbuffer_view_clear(TEXT_BUFFER_VIEW_REC *view) view_get_linecount(view, view->buffer->cur_line); view->empty_linecount = view->height; view->bottom = TRUE; + view->more_text = FALSE; textbuffer_view_redraw(view); } @@ -828,6 +830,7 @@ void textbuffer_view_scroll(TEXT_BUFFER_VIEW_REC *view, int lines) lines, TRUE); view->ypos += lines < 0 ? count : -count; view->bottom = view_is_bottom(view); + if (view->bottom) view->more_text = FALSE; if (view->window != NULL) term_refresh(view->window); @@ -848,6 +851,7 @@ void textbuffer_view_scroll_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line) textbuffer_view_init_ypos(view); view->bottom = view_is_bottom(view); + if (view->bottom) view->more_text = FALSE; textbuffer_view_redraw(view); } @@ -874,6 +878,9 @@ static void view_insert_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line) { int linecount, ypos, subline; + if (!view->bottom) + view->more_text = TRUE; + if (view->bottom_startline == NULL) { view->startline = view->bottom_startline = view->buffer->first_line; @@ -1088,6 +1095,7 @@ static void view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line, } view->bottom = view_is_bottom(view); + if (view->bottom) view->more_text = FALSE; if (view->window != NULL) term_refresh(view->window); } diff --git a/src/fe-text/textbuffer-view.h b/src/fe-text/textbuffer-view.h index 497a980d..eb0d39c6 100644 --- a/src/fe-text/textbuffer-view.h +++ b/src/fe-text/textbuffer-view.h @@ -71,6 +71,8 @@ struct _TEXT_BUFFER_VIEW_REC { int empty_linecount; /* window is at the bottom of the text buffer */ unsigned int bottom:1; + /* if !bottom - new text has been printed since we were at bottom */ + unsigned int more_text:1; /* Window needs a redraw */ unsigned int dirty:1; |