mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
Some logging fixes. Flood checking had a memory leak. Query had a small
memory leak. Text buffer fixes. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@226 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
a0aa649368
commit
ae25925a1f
10 changed files with 129 additions and 89 deletions
|
|
@ -220,7 +220,7 @@ static void gui_printtext(WINDOW_REC *window, gpointer fgcolor, gpointer bgcolor
|
|||
{
|
||||
GUI_WINDOW_REC *gui;
|
||||
LINE_REC *line;
|
||||
int fg, bg, flags, new_lines, n, visible, ypos;
|
||||
int fg, bg, flags, new_lines, n, visible, ypos, subline;
|
||||
|
||||
g_return_if_fail(window != NULL);
|
||||
|
||||
|
|
@ -265,12 +265,21 @@ static void gui_printtext(WINDOW_REC *window, gpointer fgcolor, gpointer bgcolor
|
|||
|
||||
if (visible) {
|
||||
/* draw the line to screen. */
|
||||
ypos = gui->parent->first_line+gui->ypos-new_lines;
|
||||
ypos = gui->ypos-new_lines;
|
||||
if (new_lines > 0) {
|
||||
set_color(0);
|
||||
move(ypos, 0); clrtoeol();
|
||||
move(gui->parent->first_line+ypos, 0); clrtoeol();
|
||||
}
|
||||
gui_window_line_draw(gui, line, ypos, gui->last_subline, -1);
|
||||
|
||||
if (ypos >= 0)
|
||||
subline = gui->last_subline;
|
||||
else {
|
||||
/* *LONG* line - longer than screen height */
|
||||
subline = -ypos+gui->last_subline;
|
||||
ypos = 0;
|
||||
}
|
||||
ypos += gui->parent->first_line;
|
||||
gui_window_line_draw(gui, line, ypos, subline, -1);
|
||||
}
|
||||
|
||||
gui->last_subline += new_lines;
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ static int gui_window_update_bottom(GUI_WINDOW_REC *gui, int lines)
|
|||
break;
|
||||
gui->bottom_startline = gui->bottom_startline->next;
|
||||
}
|
||||
lines--;
|
||||
}
|
||||
|
||||
return last_linecount;
|
||||
|
|
@ -471,81 +470,84 @@ void gui_window_redraw(WINDOW_REC *window)
|
|||
screen_refresh();
|
||||
}
|
||||
|
||||
static void gui_window_scroll_up(GUI_WINDOW_REC *gui, gint lines)
|
||||
#define is_window_bottom(gui) \
|
||||
((gui)->startline == (gui)->bottom_startline && \
|
||||
(gui)->subline >= (gui)->bottom_subline)
|
||||
|
||||
static void gui_window_scroll_up(GUI_WINDOW_REC *gui, int lines)
|
||||
{
|
||||
LINE_REC *line;
|
||||
gint count, linecount;
|
||||
LINE_REC *line;
|
||||
gint count, linecount;
|
||||
|
||||
if (gui->startline == NULL)
|
||||
return;
|
||||
if (gui->startline == NULL)
|
||||
return;
|
||||
|
||||
count = lines-gui->subline; gui->ypos += gui->subline;
|
||||
gui->subline = 0;
|
||||
count = lines-gui->subline; gui->ypos += gui->subline;
|
||||
gui->subline = 0;
|
||||
|
||||
while (gui->startline->prev != NULL && count > 0)
|
||||
{
|
||||
gui->startline = gui->startline->prev;
|
||||
while (gui->startline->prev != NULL && count > 0) {
|
||||
gui->startline = gui->startline->prev;
|
||||
|
||||
line = gui->startline->data;
|
||||
linecount = gui_window_get_linecount(gui, line);
|
||||
count -= linecount;
|
||||
gui->ypos += linecount;
|
||||
}
|
||||
line = gui->startline->data;
|
||||
linecount = gui_window_get_linecount(gui, line);
|
||||
count -= linecount;
|
||||
gui->ypos += linecount;
|
||||
}
|
||||
|
||||
if (count < 0)
|
||||
{
|
||||
gui->subline = -count;
|
||||
gui->ypos -= -count;
|
||||
}
|
||||
if (count < 0) {
|
||||
gui->subline = -count;
|
||||
gui->ypos -= -count;
|
||||
}
|
||||
|
||||
gui->bottom = (gui->ypos >= -1 && gui->ypos <= gui->parent->last_line-gui->parent->first_line);
|
||||
gui->bottom = is_window_bottom(gui);
|
||||
}
|
||||
|
||||
static void gui_window_scroll_down(GUI_WINDOW_REC *gui, gint lines)
|
||||
static void gui_window_scroll_down(GUI_WINDOW_REC *gui, int lines)
|
||||
{
|
||||
LINE_REC *line;
|
||||
gint count, linecount;
|
||||
LINE_REC *line;
|
||||
int count, linecount;
|
||||
|
||||
if (gui->startline == gui->bottom_startline && gui->subline == gui->bottom_subline)
|
||||
return;
|
||||
if (is_window_bottom(gui))
|
||||
return;
|
||||
|
||||
count = lines+gui->subline; gui->ypos += gui->subline;
|
||||
gui->subline = 0;
|
||||
count = lines+gui->subline; gui->ypos += gui->subline;
|
||||
gui->subline = 0;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
line = gui->startline->data;
|
||||
while (count > 0) {
|
||||
line = gui->startline->data;
|
||||
|
||||
linecount = gui_window_get_linecount(gui, line);
|
||||
count -= linecount;
|
||||
gui->ypos -= linecount;
|
||||
linecount = gui_window_get_linecount(gui, line);
|
||||
count -= linecount;
|
||||
gui->ypos -= linecount;
|
||||
|
||||
if (gui->startline == gui->bottom_startline &&
|
||||
linecount+count > gui->bottom_subline)
|
||||
{
|
||||
/* reached the last screenful of text */
|
||||
gui->subline = gui->bottom_subline;
|
||||
gui->ypos += linecount;
|
||||
gui->ypos -= gui->subline;
|
||||
break;
|
||||
if (gui->startline == gui->bottom_startline &&
|
||||
linecount+count > gui->bottom_subline) {
|
||||
/* reached the last screenful of text */
|
||||
gui->subline = gui->bottom_subline;
|
||||
gui->ypos += linecount;
|
||||
gui->ypos -= gui->subline;
|
||||
break;
|
||||
}
|
||||
|
||||
if (count == 0) {
|
||||
gui->startline = gui->startline->next;
|
||||
break;
|
||||
}
|
||||
|
||||
if (count < 0) {
|
||||
gui->subline = linecount+count;
|
||||
gui->ypos += -count;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gui->startline->next == NULL) {
|
||||
gui->subline = linecount;
|
||||
break;
|
||||
}
|
||||
gui->startline = gui->startline->next;
|
||||
}
|
||||
|
||||
if (count <= 0)
|
||||
{
|
||||
gui->subline = linecount+count;
|
||||
gui->ypos += -count;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gui->startline->next == NULL)
|
||||
{
|
||||
gui->subline = linecount;
|
||||
break;
|
||||
}
|
||||
gui->startline = gui->startline->next;
|
||||
}
|
||||
|
||||
gui->bottom = (gui->ypos >= -1 && gui->ypos <= gui->parent->last_line-gui->parent->first_line);
|
||||
gui->bottom = is_window_bottom(gui);
|
||||
}
|
||||
|
||||
void gui_window_scroll(WINDOW_REC *window, int lines)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue