1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

--more-- works again, better than ever :)

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2066 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-11-18 22:17:31 +00:00 committed by cras
parent 99120dc508
commit 18bc86bfe7
3 changed files with 39 additions and 2 deletions

View File

@ -25,6 +25,7 @@
#include "themes.h" #include "themes.h"
#include "statusbar.h" #include "statusbar.h"
#include "gui-entry.h" #include "gui-entry.h"
#include "gui-windows.h"
/* how often to redraw lagging time (seconds) */ /* how often to redraw lagging time (seconds) */
#define LAG_REFRESH_TIME 10 #define LAG_REFRESH_TIME 10
@ -33,9 +34,8 @@
the lag */ the lag */
#define MAX_LAG_UNKNOWN_TIME 30 #define MAX_LAG_UNKNOWN_TIME 30
/* activity */
static GList *activity_list; static GList *activity_list;
static int more_visible;
static GHashTable *input_entries; static GHashTable *input_entries;
static void item_window_active(SBAR_ITEM_REC *item, int get_size_only) 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) 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) 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 destroyed", (SIGNAL_FUNC) sig_statusbar_activity_window_destroyed);
signal_add("window refnum changed", (SIGNAL_FUNC) sig_statusbar_activity_updated); 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); 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 destroyed", (SIGNAL_FUNC) sig_statusbar_activity_window_destroyed);
signal_remove("window refnum changed", (SIGNAL_FUNC) sig_statusbar_activity_updated); 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); g_list_free(activity_list);
activity_list = NULL; activity_list = NULL;

View File

@ -795,6 +795,7 @@ void textbuffer_view_resize(TEXT_BUFFER_VIEW_REC *view, int width, int height)
view->subline; view->subline;
if (view->empty_linecount < view->height-linecount) if (view->empty_linecount < view->height-linecount)
view->empty_linecount = view->height-linecount; view->empty_linecount = view->height-linecount;
view->more_text = FALSE;
} }
view->dirty = TRUE; 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_get_linecount(view, view->buffer->cur_line);
view->empty_linecount = view->height; view->empty_linecount = view->height;
view->bottom = TRUE; view->bottom = TRUE;
view->more_text = FALSE;
textbuffer_view_redraw(view); textbuffer_view_redraw(view);
} }
@ -828,6 +830,7 @@ void textbuffer_view_scroll(TEXT_BUFFER_VIEW_REC *view, int lines)
lines, TRUE); lines, TRUE);
view->ypos += lines < 0 ? count : -count; view->ypos += lines < 0 ? count : -count;
view->bottom = view_is_bottom(view); view->bottom = view_is_bottom(view);
if (view->bottom) view->more_text = FALSE;
if (view->window != NULL) if (view->window != NULL)
term_refresh(view->window); 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); textbuffer_view_init_ypos(view);
view->bottom = view_is_bottom(view); view->bottom = view_is_bottom(view);
if (view->bottom) view->more_text = FALSE;
textbuffer_view_redraw(view); 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; int linecount, ypos, subline;
if (!view->bottom)
view->more_text = TRUE;
if (view->bottom_startline == NULL) { if (view->bottom_startline == NULL) {
view->startline = view->bottom_startline = view->startline = view->bottom_startline =
view->buffer->first_line; 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); view->bottom = view_is_bottom(view);
if (view->bottom) view->more_text = FALSE;
if (view->window != NULL) if (view->window != NULL)
term_refresh(view->window); term_refresh(view->window);
} }

View File

@ -71,6 +71,8 @@ struct _TEXT_BUFFER_VIEW_REC {
int empty_linecount; int empty_linecount;
/* window is at the bottom of the text buffer */ /* window is at the bottom of the text buffer */
unsigned int bottom:1; 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 */ /* Window needs a redraw */
unsigned int dirty:1; unsigned int dirty:1;