mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05: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:
parent
d0dcffab7b
commit
4faf4d1303
@ -245,33 +245,31 @@ static void cmd_scrollback_clear(gchar *data)
|
|||||||
|
|
||||||
static void scrollback_goto_pos(WINDOW_REC *window, GList *pos)
|
static void scrollback_goto_pos(WINDOW_REC *window, GList *pos)
|
||||||
{
|
{
|
||||||
GUI_WINDOW_REC *gui;
|
GUI_WINDOW_REC *gui;
|
||||||
|
|
||||||
g_return_if_fail(window != NULL);
|
g_return_if_fail(window != NULL);
|
||||||
g_return_if_fail(pos != NULL);
|
g_return_if_fail(pos != NULL);
|
||||||
|
|
||||||
gui = WINDOW_GUI(window);
|
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->startline = pos;
|
gui->subline = 0;
|
||||||
gui->subline = 0;
|
gui_window_update_ypos(gui);
|
||||||
gui->bottom = FALSE;
|
gui->bottom = is_window_bottom(gui);
|
||||||
}
|
} else {
|
||||||
else
|
/* reached the last line */
|
||||||
{
|
if (gui->bottom) return;
|
||||||
/* reached the last line */
|
|
||||||
if (gui->bottom) return;
|
|
||||||
|
|
||||||
gui->bottom = TRUE;
|
gui->startline = gui->bottom_startline;
|
||||||
gui->startline = gui->bottom_startline;
|
gui->subline = gui->bottom_subline;
|
||||||
gui->subline = gui->bottom_subline;
|
gui->ypos = gui->parent->last_line-gui->parent->first_line;
|
||||||
gui->ypos = gui->parent->last_line-gui->parent->first_line-1;
|
gui->bottom = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_window_visible(window))
|
if (is_window_visible(window))
|
||||||
gui_window_redraw(window);
|
gui_window_redraw(window);
|
||||||
signal_emit("gui page scrolled", 1, window);
|
signal_emit("gui page scrolled", 1, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cmd_scrollback_goto(gchar *data)
|
static void cmd_scrollback_goto(gchar *data)
|
||||||
@ -366,38 +364,39 @@ static void cmd_scrollback_goto(gchar *data)
|
|||||||
cmd_params_free(free_arg);
|
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_REC *gui;
|
||||||
|
|
||||||
gui = WINDOW_GUI(active_win);
|
gui = WINDOW_GUI(active_win);
|
||||||
|
|
||||||
if (gui->bottom_startline == gui->startline)
|
if (gui->startline == gui->lines)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gui->bottom = FALSE;
|
gui->startline = gui->lines;
|
||||||
gui->startline = gui->lines;
|
gui->subline = 0;
|
||||||
gui->subline = 0;
|
gui_window_update_ypos(gui);
|
||||||
|
gui->bottom = is_window_bottom(gui);
|
||||||
|
|
||||||
if (is_window_visible(active_win))
|
if (is_window_visible(active_win))
|
||||||
gui_window_redraw(active_win);
|
gui_window_redraw(active_win);
|
||||||
signal_emit("gui page scrolled", 1, 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_REC *gui;
|
||||||
|
|
||||||
gui = WINDOW_GUI(active_win);
|
gui = WINDOW_GUI(active_win);
|
||||||
|
|
||||||
gui->bottom = TRUE;
|
gui->startline = gui->bottom_startline;
|
||||||
gui->startline = gui->bottom_startline;
|
gui->subline = gui->bottom_subline;
|
||||||
gui->subline = gui->bottom_subline;
|
gui->ypos = gui->parent->last_line-gui->parent->first_line;
|
||||||
gui->ypos = gui->parent->last_line-gui->parent->first_line-1;
|
gui->bottom = TRUE;
|
||||||
|
|
||||||
if (is_window_visible(active_win))
|
if (is_window_visible(active_win))
|
||||||
gui_window_redraw(active_win);
|
gui_window_redraw(active_win);
|
||||||
signal_emit("gui page scrolled", 1, active_win);
|
signal_emit("gui page scrolled", 1, active_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_away_changed(IRC_SERVER_REC *server)
|
static void sig_away_changed(IRC_SERVER_REC *server)
|
||||||
|
@ -184,9 +184,6 @@ static int gui_window_update_bottom(GUI_WINDOW_REC *gui, int lines)
|
|||||||
return last_linecount;
|
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)
|
void gui_window_newline(GUI_WINDOW_REC *gui, int visible)
|
||||||
{
|
{
|
||||||
/* FIXME: I'm pretty sure this could be done cleaner :) */
|
/* 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);
|
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)
|
void window_update_prompt(WINDOW_REC *window)
|
||||||
{
|
{
|
||||||
WI_ITEM_REC *item;
|
WI_ITEM_REC *item;
|
||||||
|
@ -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_resize(WINDOW_REC *window, int ychange, int xchange);
|
||||||
void gui_window_reparent(WINDOW_REC *window, MAIN_WINDOW_REC *parent);
|
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 window_update_prompt(WINDOW_REC *window);
|
||||||
void gui_window_newline(GUI_WINDOW_REC *gui, int visible);
|
void gui_window_newline(GUI_WINDOW_REC *gui, int visible);
|
||||||
void gui_window_scroll(WINDOW_REC *window, int lines);
|
void gui_window_scroll(WINDOW_REC *window, int lines);
|
||||||
|
void gui_window_update_ypos(GUI_WINDOW_REC *gui);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user