0
0
mirror of https://github.com/irssi/irssi.git synced 2025-06-30 22:18:06 -04:00

/SCROLLBACK HOME/END/GOTO commands weren't working right.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@396 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-06-30 19:45:28 +00:00 committed by cras
parent d0dcffab7b
commit 4faf4d1303
3 changed files with 57 additions and 46 deletions

View File

@ -252,21 +252,19 @@ static void scrollback_goto_pos(WINDOW_REC *window, GList *pos)
gui = WINDOW_GUI(window);
if (g_list_find(gui->bottom_startline, pos->data) == NULL)
{
if (g_list_find(gui->bottom_startline, pos->data) == NULL) {
gui->startline = pos;
gui->subline = 0;
gui->bottom = FALSE;
}
else
{
gui_window_update_ypos(gui);
gui->bottom = is_window_bottom(gui);
} else {
/* reached the last line */
if (gui->bottom) return;
gui->bottom = TRUE;
gui->startline = gui->bottom_startline;
gui->subline = gui->bottom_subline;
gui->ypos = gui->parent->last_line-gui->parent->first_line-1;
gui->ypos = gui->parent->last_line-gui->parent->first_line;
gui->bottom = TRUE;
}
if (is_window_visible(window))
@ -366,34 +364,35 @@ static void cmd_scrollback_goto(gchar *data)
cmd_params_free(free_arg);
}
static void cmd_scrollback_home(gchar *data)
static void cmd_scrollback_home(const char *data)
{
GUI_WINDOW_REC *gui;
gui = WINDOW_GUI(active_win);
if (gui->bottom_startline == gui->startline)
if (gui->startline == gui->lines)
return;
gui->bottom = FALSE;
gui->startline = gui->lines;
gui->subline = 0;
gui_window_update_ypos(gui);
gui->bottom = is_window_bottom(gui);
if (is_window_visible(active_win))
gui_window_redraw(active_win);
signal_emit("gui page scrolled", 1, active_win);
}
static void cmd_scrollback_end(gchar *data)
static void cmd_scrollback_end(const char *data)
{
GUI_WINDOW_REC *gui;
gui = WINDOW_GUI(active_win);
gui->bottom = TRUE;
gui->startline = gui->bottom_startline;
gui->subline = gui->bottom_subline;
gui->ypos = gui->parent->last_line-gui->parent->first_line-1;
gui->ypos = gui->parent->last_line-gui->parent->first_line;
gui->bottom = TRUE;
if (is_window_visible(active_win))
gui_window_redraw(active_win);

View File

@ -184,9 +184,6 @@ static int gui_window_update_bottom(GUI_WINDOW_REC *gui, int lines)
return last_linecount;
}
#define is_window_bottom(gui) \
((gui)->ypos >= -1 && (gui)->ypos <= (gui)->parent->last_line-(gui)->parent->first_line)
void gui_window_newline(GUI_WINDOW_REC *gui, int visible)
{
/* FIXME: I'm pretty sure this could be done cleaner :) */
@ -601,6 +598,17 @@ void gui_window_scroll(WINDOW_REC *window, int lines)
signal_emit("gui page scrolled", 1, window);
}
void gui_window_update_ypos(GUI_WINDOW_REC *gui)
{
GList *tmp;
g_return_if_fail(gui != NULL);
gui->ypos = -gui->subline-1;
for (tmp = gui->startline; tmp != NULL; tmp = tmp->next)
gui->ypos += gui_window_get_linecount(gui, tmp->data);
}
void window_update_prompt(WINDOW_REC *window)
{
WI_ITEM_REC *item;

View File

@ -99,8 +99,12 @@ void gui_window_redraw(WINDOW_REC *window);
void gui_window_resize(WINDOW_REC *window, int ychange, int xchange);
void gui_window_reparent(WINDOW_REC *window, MAIN_WINDOW_REC *parent);
#define is_window_bottom(gui) \
((gui)->ypos >= -1 && (gui)->ypos <= (gui)->parent->last_line-(gui)->parent->first_line)
void window_update_prompt(WINDOW_REC *window);
void gui_window_newline(GUI_WINDOW_REC *gui, int visible);
void gui_window_scroll(WINDOW_REC *window, int lines);
void gui_window_update_ypos(GUI_WINDOW_REC *gui);
#endif