mirror of
https://github.com/irssi/irssi.git
synced 2026-08-22 10:02:22 +02:00
Merge c9229f73b3 into 191e0ac84e
This commit is contained in:
commit
ec92f8fe0e
1 changed files with 30 additions and 2 deletions
|
|
@ -21,6 +21,7 @@
|
||||||
#define G_LOG_DOMAIN "TextBufferView"
|
#define G_LOG_DOMAIN "TextBufferView"
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
|
#include "levels.h"
|
||||||
#include "textbuffer-view.h"
|
#include "textbuffer-view.h"
|
||||||
#include "signals.h"
|
#include "signals.h"
|
||||||
#include "utf8.h"
|
#include "utf8.h"
|
||||||
|
|
@ -1277,6 +1278,28 @@ void textbuffer_view_remove_line(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
|
||||||
textbuffer_remove(view->buffer, line);
|
textbuffer_remove(view->buffer, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: this works better than the existing /lastlog logic, however
|
||||||
|
// this fails when the log is *much* longer than the screen size,
|
||||||
|
// so additional logic will be need to handle that; specifically
|
||||||
|
// consider simply reusing logic from the /clear function
|
||||||
|
void textbuffer_view_remove_line_from_lastlog(TEXT_BUFFER_VIEW_REC *view, LINE_REC *line)
|
||||||
|
{
|
||||||
|
unsigned char update_counter;
|
||||||
|
|
||||||
|
g_return_if_fail(view != NULL);
|
||||||
|
g_return_if_fail(line != NULL);
|
||||||
|
|
||||||
|
signal_emit("gui lastlog textbuffer line removed", 3, view, line, line->prev);
|
||||||
|
|
||||||
|
// set the cache update counter
|
||||||
|
update_counter = view->cache->update_counter+1;
|
||||||
|
view_remove_cache(view, line, update_counter);
|
||||||
|
|
||||||
|
// remove the lines and reset the y-position
|
||||||
|
textbuffer_remove(view->buffer, line);
|
||||||
|
textbuffer_view_init_ypos(view);
|
||||||
|
}
|
||||||
|
|
||||||
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, *next;
|
||||||
|
|
@ -1287,8 +1310,13 @@ void textbuffer_view_remove_lines_by_level(TEXT_BUFFER_VIEW_REC *view, int level
|
||||||
while (line != NULL) {
|
while (line != NULL) {
|
||||||
next = line->next;
|
next = line->next;
|
||||||
|
|
||||||
if (line->info.level & level)
|
if (line->info.level & level) {
|
||||||
textbuffer_view_remove_line(view, line);
|
if (level == MSGLEVEL_LASTLOG) {
|
||||||
|
textbuffer_view_remove_line_from_lastlog(view, line);
|
||||||
|
} else {
|
||||||
|
textbuffer_view_remove_line(view, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
line = next;
|
line = next;
|
||||||
}
|
}
|
||||||
textbuffer_view_redraw(view);
|
textbuffer_view_redraw(view);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue