forked from PsychoticNinja/ailin-nemui-irssi
[wip] fix lastlog -clear not resetting /clear
This commit is contained in:
parent
bf3565a720
commit
a67775db88
@ -1171,26 +1171,83 @@ static void view_remove_line_update_startline(TEXT_BUFFER_VIEW_REC *view,
|
|||||||
LINE_REC *line, int linecount)
|
LINE_REC *line, int linecount)
|
||||||
{
|
{
|
||||||
int scroll;
|
int scroll;
|
||||||
|
GString *line_text;
|
||||||
|
|
||||||
|
line_text = g_string_new(NULL);
|
||||||
|
|
||||||
|
if (view->startline != NULL)
|
||||||
|
textbuffer_line2text(view->startline, FALSE, line_text);
|
||||||
|
|
||||||
|
fprintf(stderr, "view_remove_line_update_startline\n"
|
||||||
|
".. height: %d\n"
|
||||||
|
".. ypos: %d\n"
|
||||||
|
".. subline: %d\n"
|
||||||
|
"..empty_linecount: %d\n"
|
||||||
|
".. startline: %s\n",
|
||||||
|
view->height, view->ypos, view->subline, view->empty_linecount, line_text->str);
|
||||||
|
g_string_truncate(line_text, 0);
|
||||||
|
if (line != NULL)
|
||||||
|
textbuffer_line2text(line, FALSE, line_text);
|
||||||
|
fprintf(stderr,
|
||||||
|
".. line: %s\n", line_text->str);
|
||||||
|
g_string_truncate(line_text, 0);
|
||||||
|
|
||||||
if (view->startline == line) {
|
if (view->startline == line) {
|
||||||
view->startline = view->startline->prev != NULL ?
|
view->startline = view->startline->prev != NULL ?
|
||||||
view->startline->prev : view->startline->next;
|
view->startline->prev : view->startline->next;
|
||||||
view->subline = 0;
|
view->subline = 0;
|
||||||
|
|
||||||
|
if (view->startline != NULL)
|
||||||
|
textbuffer_line2text(view->startline, FALSE, line_text);
|
||||||
|
fprintf(stderr, "... moving startline ...\n"
|
||||||
|
".. subline: %d\n"
|
||||||
|
".. startline: %s\n",
|
||||||
|
view->subline, line_text->str);
|
||||||
|
g_string_truncate(line_text, 0);
|
||||||
} else {
|
} else {
|
||||||
scroll = view->height -
|
scroll = view->height -
|
||||||
view_get_lines_height(view, view->startline,
|
view_get_lines_height(view, view->startline,
|
||||||
view->subline, line);
|
view->subline, line);
|
||||||
if (scroll > 0) {
|
fprintf(stderr, "... other line ...\n"
|
||||||
|
".. scroll: %d\n",
|
||||||
|
scroll);
|
||||||
|
if (view->empty_linecount > 0) {
|
||||||
|
view->empty_linecount += scroll;
|
||||||
|
if (view->empty_linecount < 0)
|
||||||
|
view->empty_linecount = 0;
|
||||||
|
else if (view->empty_linecount > view->height)
|
||||||
|
view->empty_linecount = view->height;
|
||||||
|
fprintf(stderr, "... changing empty_linecount ...\n"
|
||||||
|
"..empty_linecount: %d\n",
|
||||||
|
view->empty_linecount);
|
||||||
|
} else if (scroll > 0) {
|
||||||
view_scroll(view, &view->startline,
|
view_scroll(view, &view->startline,
|
||||||
&view->subline, -scroll, FALSE);
|
&view->subline, -scroll, FALSE);
|
||||||
|
textbuffer_line2text(view->startline, FALSE, line_text);
|
||||||
|
fprintf(stderr, "... scrolling ...\n"
|
||||||
|
".. subline: %d\n"
|
||||||
|
".. startline: %s\n",
|
||||||
|
view->subline, line_text->str);
|
||||||
|
g_string_truncate(line_text, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fprintf(stderr,
|
||||||
|
".. linecount: %d\n",
|
||||||
|
linecount);
|
||||||
|
|
||||||
/* FIXME: this is slow and unnecessary, but it's easy and
|
/* FIXME: this is slow and unnecessary, but it's easy and
|
||||||
really works :) */
|
really works :) */
|
||||||
textbuffer_view_init_ypos(view);
|
textbuffer_view_init_ypos(view);
|
||||||
if (textbuffer_line_exists_after(view->startline, line))
|
fprintf(stderr, "... init_ypos ...\n"
|
||||||
|
".. ypos: %d\n",
|
||||||
|
view->ypos);
|
||||||
|
if (view->empty_linecount == 0 && textbuffer_line_exists_after(view->startline, line)) {
|
||||||
view->ypos -= linecount;
|
view->ypos -= linecount;
|
||||||
|
fprintf(stderr, "... moving ypos by linecount ...\n"
|
||||||
|
".. ypos: %d\n",
|
||||||
|
view->ypos);
|
||||||
|
}
|
||||||
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
|
static void view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
|
||||||
@ -1242,7 +1299,9 @@ static void view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line,
|
|||||||
realcount = view_scroll(view, &view->bottom_startline,
|
realcount = view_scroll(view, &view->bottom_startline,
|
||||||
&view->bottom_subline,
|
&view->bottom_subline,
|
||||||
-linecount, FALSE);
|
-linecount, FALSE);
|
||||||
|
fprintf(stderr, "adjusting empty_linecount [ %d -> ", view->empty_linecount);
|
||||||
view->empty_linecount += linecount-realcount;
|
view->empty_linecount += linecount-realcount;
|
||||||
|
fprintf(stderr, "%d , linecount: %d, realcount: %d ]\n", view->empty_linecount, linecount, realcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view->bottom_startline == line) {
|
if (view->bottom_startline == line) {
|
||||||
@ -1298,17 +1357,17 @@ void textbuffer_view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
|
|||||||
|
|
||||||
void textbuffer_view_remove_lines_by_level(TEXT_BUFFER_VIEW_REC *view, int level)
|
void textbuffer_view_remove_lines_by_level(TEXT_BUFFER_VIEW_REC *view, int level)
|
||||||
{
|
{
|
||||||
LINE_REC *line, *next;
|
LINE_REC *line, *prev;
|
||||||
|
|
||||||
term_refresh_freeze();
|
term_refresh_freeze();
|
||||||
line = textbuffer_view_get_lines(view);
|
line = textbuffer_line_last(view->buffer);
|
||||||
|
|
||||||
while (line != NULL) {
|
while (line != NULL) {
|
||||||
next = line->next;
|
prev = line->prev;
|
||||||
|
|
||||||
if (line->info.level & level)
|
if (line->info.level & level)
|
||||||
textbuffer_view_remove_line(view, line);
|
textbuffer_view_remove_line(view, line);
|
||||||
line = next;
|
line = prev;
|
||||||
}
|
}
|
||||||
textbuffer_view_redraw(view);
|
textbuffer_view_redraw(view);
|
||||||
term_refresh_thaw();
|
term_refresh_thaw();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user