2 * Copyright (C) 2008 - 2016 The Geeqie Team
4 * Authors: Vladimir Nadvornik, Laurent Monin
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include "logwindow.h"
36 GtkWidget *scrolledwin;
38 GtkTextTag *color_tags[LOG_COUNT];
40 GtkWidget *regexp_box;
44 GtkWidget *timer_data;
45 GtkWidget *debug_level;
46 gint debug_value; /**< Not used */
47 GtkWidget *search_entry_box;
48 gboolean highlight_all;
51 enum LogWindowSearchDirection {
52 LOGWINDOW_SEARCH_BACKWARDS,
53 LOGWINDOW_SEARCH_FORWARDS
56 static LogWindow *logwindow = nullptr;
58 static void hide_cb(GtkWidget *, LogWindow *)
63 * @brief Handle escape and F1 keys
69 * If escape key pressed, hide log window. \n
70 * If no text selected, select the entire line. \n
71 * If F1 pressed, execute command line program: \n
72 * <options->log_window.action> <selected text>
75 static gboolean key_pressed(GtkWidget *, GdkEventKey *event, LogWindow *logwin)
79 GtkTextBuffer *buffer;
81 GtkTextIter chr_marker;
82 GtkTextIter chr_start;
83 GtkTextIter cursor_iter;
85 GtkTextIter line_start;
86 GtkTextMark *cursor_mark;
88 if (event && event->keyval == GDK_KEY_Escape)
89 gtk_widget_hide(logwin->window);
91 if (event && event->keyval == GDK_KEY_F1)
93 if (strlen(options->log_window.action) > 0)
95 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
97 if (!gtk_text_buffer_get_has_selection(buffer))
99 cursor_mark = gtk_text_buffer_get_insert(buffer);
100 gtk_text_buffer_get_iter_at_mark(buffer, &cursor_iter, cursor_mark);
102 line_start = cursor_iter;
103 gtk_text_iter_set_line_offset(&line_start, 0);
104 line_end = cursor_iter;
105 gtk_text_iter_forward_to_line_end(&line_end);
106 chr_marker = line_end;
107 gtk_text_buffer_select_range(buffer, &line_start, &line_end);
110 if (gtk_text_buffer_get_selection_bounds(gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text)), &chr_start, &chr_end))
112 sel_text = gtk_text_buffer_get_text( gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text)), &chr_start, &chr_end, FALSE);
114 cmd_line = g_strconcat(options->log_window.action, " \"", sel_text, "\"", NULL);
128 static void log_window_pause_cb(GtkWidget *, gpointer)
130 options->log_window.paused = !options->log_window.paused;
133 static void log_window_line_wrap_cb(GtkWidget *, gpointer data)
135 auto logwin = static_cast<LogWindow *>(data);
137 options->log_window.line_wrap = !options->log_window.line_wrap;
139 if (options->log_window.line_wrap)
141 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(logwin->text), GTK_WRAP_WORD);
145 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(logwin->text), GTK_WRAP_NONE);
149 static void log_window_timer_data_cb(GtkWidget *, gpointer)
151 options->log_window.timer_data = !options->log_window.timer_data;
154 static void log_window_regexp_cb(GtkWidget *text_entry, gpointer)
158 new_regexp = g_strdup(gq_gtk_entry_get_text(GTK_ENTRY(text_entry)));
159 set_regexp(new_regexp);
163 static void remove_green_bg(LogWindow *logwin)
165 GtkTextIter start_find;
166 GtkTextIter start_match;
167 GtkTextIter end_match;
168 GtkTextBuffer *buffer;
174 text = gq_gtk_entry_get_text(GTK_ENTRY(logwin->search_entry_box));
175 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
176 gtk_text_buffer_get_start_iter(buffer, &start_find);
178 while (gtk_text_iter_forward_search(&start_find, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr))
180 list = gtk_text_iter_get_tags(&start_match);
183 g_object_get(list->data, "name", &tag_name, NULL);
184 if (g_strcmp0(tag_name, "green_bg") == 0)
186 gtk_text_buffer_remove_tag_by_name(buffer, "green_bg", &start_match, &end_match);
192 offset = gtk_text_iter_get_offset(&end_match);
193 gtk_text_buffer_get_iter_at_offset(buffer, &start_find, offset);
197 static void search_activate_event(GtkEntry *, LogWindow *logwin)
199 GtkTextIter start_find;
200 GtkTextIter start_match;
201 GtkTextIter end_match;
202 GtkTextBuffer *buffer;
203 GtkTextMark *cursor_mark;
204 GtkTextIter cursor_iter;
208 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
209 text = gq_gtk_entry_get_text(GTK_ENTRY(logwin->search_entry_box));
211 if (logwin->highlight_all)
213 gtk_text_buffer_get_start_iter(buffer, &start_find);
215 while (gtk_text_iter_forward_search(&start_find, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr))
217 gtk_text_buffer_apply_tag_by_name(buffer, "gray_bg", &start_match, &end_match);
218 offset = gtk_text_iter_get_offset(&end_match);
219 gtk_text_buffer_get_iter_at_offset(buffer, &start_find, offset);
224 cursor_mark = gtk_text_buffer_get_insert(buffer);
225 gtk_text_buffer_get_iter_at_mark(buffer, &cursor_iter, cursor_mark);
227 if (gtk_text_iter_forward_search(&cursor_iter, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr))
229 gtk_text_buffer_apply_tag_by_name(buffer, "gray_bg", &start_match, &end_match);
234 static gboolean search_keypress_event(GtkWidget *, GdkEventKey *, LogWindow *logwin, LogWindowSearchDirection direction)
236 GtkTextIter start_find;
237 GtkTextIter start_match;
238 GtkTextIter end_match;
239 GtkTextIter start_sel;
242 GtkTextBuffer *buffer;
243 GtkTextMark *cursor_mark;
244 GtkTextIter cursor_iter;
246 gboolean match_found = FALSE;
249 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
250 gtk_text_buffer_get_start_iter(buffer, &start_find);
252 text = gq_gtk_entry_get_text(GTK_ENTRY(logwin->search_entry_box));
253 if (strlen(text) == 0)
255 selected = gtk_text_buffer_get_selection_bounds(buffer, &start_sel, &end_sel);
258 text = gtk_text_buffer_get_text(buffer, &start_sel, &end_sel, FALSE);
259 gq_gtk_entry_set_text(GTK_ENTRY(logwin->search_entry_box), text);
263 if (logwin->highlight_all)
265 while (gtk_text_iter_forward_search(&start_find, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr))
267 gtk_text_buffer_apply_tag_by_name(buffer, "gray_bg", &start_match, &end_match);
268 offset = gtk_text_iter_get_offset(&end_match);
269 gtk_text_buffer_get_iter_at_offset(buffer, &start_find, offset);
273 cursor_mark = gtk_text_buffer_get_insert(buffer);
274 gtk_text_buffer_get_iter_at_mark(buffer, &cursor_iter, cursor_mark);
276 if (direction == LOGWINDOW_SEARCH_BACKWARDS)
278 match_found = gtk_text_iter_backward_search( &cursor_iter, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr);
282 match_found = gtk_text_iter_forward_search( &cursor_iter, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr);
287 remove_green_bg(logwin);
289 gtk_text_buffer_apply_tag_by_name(buffer, "green_bg", &start_match, &end_match);
291 if (direction == LOGWINDOW_SEARCH_BACKWARDS)
293 gtk_text_buffer_place_cursor(buffer, &start_match);
297 gtk_text_buffer_place_cursor(buffer, &end_match);
300 cursor_mark = gtk_text_buffer_get_insert(buffer);
301 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(logwin->text), cursor_mark, 0.2, FALSE, 0.0, 0.0);
307 static gboolean backwards_keypress_event_cb(GtkWidget *widget, GdkEventKey *event, LogWindow *logwin)
309 search_keypress_event(widget, event, logwin, LOGWINDOW_SEARCH_BACKWARDS);
314 static gboolean forwards_keypress_event_cb(GtkWidget *widget, GdkEventKey *event, LogWindow *logwin)
316 search_keypress_event(widget, event, logwin, LOGWINDOW_SEARCH_FORWARDS);
321 static gboolean all_keypress_event_cb(GtkToggleButton *widget, LogWindow *logwin)
323 logwin->highlight_all = gtk_toggle_button_get_active(widget);
328 static gboolean debug_changed_cb(GtkSpinButton *widget, LogWindow *)
330 set_debug_level((gtk_spin_button_get_value(widget)));
335 static void search_entry_icon_cb(GtkEntry *, GtkEntryIconPosition pos, GdkEvent *, gpointer userdata)
337 auto logwin = static_cast<LogWindow *>(userdata);
338 GtkTextIter start_find;
339 GtkTextIter end_find;
340 GtkTextBuffer *buffer;
342 if (pos == GTK_ENTRY_ICON_SECONDARY)
344 gq_gtk_entry_set_text(GTK_ENTRY(logwin->search_entry_box), "");
346 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
347 gtk_text_buffer_get_start_iter(buffer, &start_find);
348 gtk_text_buffer_get_end_iter(buffer, &end_find);
349 gtk_text_buffer_remove_tag_by_name(buffer, "gray_bg", &start_find, &end_find);
350 gtk_text_buffer_remove_tag_by_name(buffer, "green_bg", &start_find, &end_find);
354 static void filter_entry_icon_cb(GtkEntry *entry, GtkEntryIconPosition, GdkEvent *, gpointer)
356 const gchar *blank = "";
357 gq_gtk_entry_set_text(entry, blank);
361 static LogWindow *log_window_create(LayoutWindow *lw)
365 GtkWidget *scrolledwin;
367 GtkTextBuffer *buffer;
372 GtkWidget *label = nullptr;
373 GtkWidget *search_box;
374 GtkWidget *backwards_button;
375 GtkWidget *forwards_button;
376 GtkWidget *all_button;
379 GtkWidget *image = nullptr;
381 logwin = g_new0(LogWindow, 1);
383 window = window_new("log", nullptr, nullptr, _("Log"));
385 win_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, PREF_PAD_SPACE);
386 gq_gtk_container_add(GTK_WIDGET(window), win_vbox);
387 gtk_widget_show(win_vbox);
389 gtk_window_resize(GTK_WINDOW(window), lw->options.log_window.w,
390 lw->options.log_window.h);
391 gq_gtk_window_move(GTK_WINDOW(window), lw->options.log_window.x, lw->options.log_window.y);
393 g_signal_connect(G_OBJECT(window), "delete_event",
394 G_CALLBACK(gtk_widget_hide_on_delete), NULL);
395 g_signal_connect(G_OBJECT(window), "key_press_event",
396 G_CALLBACK(key_pressed), logwin);
397 g_signal_connect(G_OBJECT(window), "hide",
398 G_CALLBACK(hide_cb), logwin);
399 gtk_widget_realize(window);
401 scrolledwin = gq_gtk_scrolled_window_new(nullptr, nullptr);
402 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
403 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
404 gq_gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin),
407 gq_gtk_box_pack_start(GTK_BOX(win_vbox), scrolledwin, TRUE, TRUE, 0);
408 gtk_widget_show(scrolledwin);
410 text = gtk_text_view_new();
411 gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
412 if (options->log_window.line_wrap)
414 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
418 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_NONE);
420 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
421 gtk_text_buffer_get_start_iter(buffer, &iter);
422 gtk_text_buffer_create_mark(buffer, "end", &iter, FALSE);
423 gq_gtk_container_add(GTK_WIDGET(scrolledwin), text);
424 gtk_widget_show(text);
427 gtk_text_buffer_create_tag(buffer, "gray_bg", "background", "gray", NULL);
428 gtk_text_buffer_create_tag(buffer, "green_bg", "background", "#00FF00", NULL);
430 hbox = pref_box_new(win_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
432 gtk_widget_show(hbox);
433 logwin->debug_level = pref_spin_new_int(hbox, _("Debug level:"), nullptr, 0, 4, 1, get_debug_level(), &logwin->debug_value);
434 g_signal_connect(logwin->debug_level, "value-changed", G_CALLBACK(debug_changed_cb), logwin);
436 logwin->pause = gtk_toggle_button_new();
437 label = gtk_label_new("Pause");
438 gtk_widget_set_tooltip_text(GTK_WIDGET(logwin->pause), _("Pause scrolling"));
439 gq_gtk_container_add(GTK_WIDGET(logwin->pause), label) ;
440 gq_gtk_box_pack_start(GTK_BOX(hbox),logwin->pause, FALSE, FALSE, 0) ;
441 g_signal_connect(logwin->pause, "toggled", G_CALLBACK(log_window_pause_cb), logwin);
442 gtk_widget_show_all(logwin->pause);
444 logwin->wrap = gtk_toggle_button_new();
445 label = gtk_label_new("Wrap");
446 gtk_widget_set_tooltip_text(GTK_WIDGET(logwin->wrap), _("Enable line wrap"));
447 gq_gtk_container_add(GTK_WIDGET(logwin->wrap), label) ;
448 gq_gtk_box_pack_start(GTK_BOX(hbox),logwin->wrap, FALSE, FALSE, 0) ;
449 g_signal_connect(logwin->wrap, "toggled", G_CALLBACK(log_window_line_wrap_cb), logwin);
450 gtk_widget_show_all(logwin->wrap);
452 logwin->timer_data = gtk_toggle_button_new();
453 label = gtk_label_new("Timer");
454 gtk_widget_set_tooltip_text(GTK_WIDGET(logwin->timer_data), _("Enable timer data"));
455 gq_gtk_container_add(GTK_WIDGET(logwin->timer_data), label) ;
456 gq_gtk_box_pack_start(GTK_BOX(hbox),logwin->timer_data, FALSE, FALSE, 0) ;
457 if (options->log_window.timer_data)
459 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logwin->timer_data), TRUE);
461 g_signal_connect(logwin->timer_data, "toggled", G_CALLBACK(log_window_timer_data_cb), logwin);
462 gtk_widget_show_all(logwin->timer_data);
464 search_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
465 gq_gtk_container_add(GTK_WIDGET(hbox), search_box);
466 gtk_widget_show(search_box);
468 logwin->search_entry_box = gtk_entry_new();
469 gq_gtk_box_pack_start(GTK_BOX(search_box), logwin->search_entry_box, FALSE, FALSE, 0);
470 gtk_widget_show(logwin->search_entry_box);
471 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(logwin->search_entry_box), GTK_ENTRY_ICON_PRIMARY, GQ_ICON_FIND);
472 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(logwin->search_entry_box), GTK_ENTRY_ICON_SECONDARY, GQ_ICON_CLEAR);
473 gtk_widget_show(search_box);
474 gtk_widget_set_tooltip_text(logwin->search_entry_box, _("Search for text in log window"));
475 g_signal_connect(logwin->search_entry_box, "icon-press", G_CALLBACK(search_entry_icon_cb), logwin);
476 g_signal_connect(logwin->search_entry_box, "activate", G_CALLBACK(search_activate_event), logwin);
478 theme = gtk_icon_theme_get_default();
479 pixbuf = gtk_icon_theme_load_icon(theme, GQ_ICON_PAN_UP, 20, GTK_ICON_LOOKUP_GENERIC_FALLBACK, nullptr);
480 image = gtk_image_new_from_pixbuf(pixbuf);
481 backwards_button = gtk_button_new();
482 gtk_button_set_image(GTK_BUTTON(backwards_button), GTK_WIDGET(image));
483 gtk_widget_set_tooltip_text(backwards_button, _("Search backwards"));
484 gq_gtk_box_pack_start(GTK_BOX(search_box), backwards_button, FALSE, FALSE, 0);
485 gtk_widget_show(backwards_button);
486 g_signal_connect(backwards_button, "button_release_event", G_CALLBACK(backwards_keypress_event_cb), logwin);
487 g_object_unref(pixbuf);
489 pixbuf = gtk_icon_theme_load_icon(theme, GQ_ICON_PAN_DOWN, 20, GTK_ICON_LOOKUP_GENERIC_FALLBACK, nullptr);
490 image = gtk_image_new_from_pixbuf(pixbuf);
491 forwards_button = gtk_button_new();
492 gtk_button_set_image(GTK_BUTTON(forwards_button), GTK_WIDGET(image));
493 gtk_widget_set_tooltip_text(forwards_button, _("Search forwards"));
494 gq_gtk_box_pack_start(GTK_BOX(search_box), forwards_button, FALSE, FALSE, 0);
495 gtk_widget_show(forwards_button);
496 g_signal_connect(forwards_button, "button_release_event", G_CALLBACK(forwards_keypress_event_cb), logwin);
497 g_object_unref(pixbuf);
499 pixbuf = gtk_icon_theme_load_icon(theme, "edit-select-all-symbolic", 20, GTK_ICON_LOOKUP_GENERIC_FALLBACK, nullptr);
500 image = gtk_image_new_from_pixbuf(pixbuf);
501 all_button = gtk_toggle_button_new();
502 gtk_button_set_image(GTK_BUTTON(all_button), GTK_WIDGET(image));
503 gtk_widget_set_tooltip_text(GTK_WIDGET(all_button), _("Highlight all"));
504 gq_gtk_box_pack_start(GTK_BOX(search_box), all_button, FALSE, FALSE, 0) ;
505 g_signal_connect(all_button, "toggled", G_CALLBACK(all_keypress_event_cb), logwin);
506 gtk_widget_show_all(all_button);
507 g_object_unref(pixbuf);
509 pref_label_new(hbox, _("Filter regexp"));
511 textbox = gtk_entry_new();
512 gq_gtk_box_pack_start(GTK_BOX(hbox), textbox, FALSE, FALSE, 0);
513 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(textbox), GTK_ENTRY_ICON_SECONDARY, GQ_ICON_CLEAR);
514 gtk_widget_show(textbox);
515 g_signal_connect(G_OBJECT(textbox), "activate",
516 G_CALLBACK(log_window_regexp_cb), logwin);
517 g_signal_connect(textbox, "icon-press", G_CALLBACK(filter_entry_icon_cb), logwin);
520 logwin->window = window;
521 logwin->scrolledwin = scrolledwin;
524 logwin->regexp_box = textbox;
525 lw->log_window = logwin->window;
529 static void log_window_init(LogWindow *logwin)
531 GtkTextBuffer *buffer;
533 g_assert(logwin != nullptr);
535 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
537 logwin->color_tags[LOG_NORMAL] = gtk_text_buffer_create_tag (buffer,
538 "black_foreground", "foreground", "black",
539 "family", "MonoSpace", NULL);
540 logwin->color_tags[LOG_MSG] = gtk_text_buffer_create_tag (buffer,
541 "blue_foreground", "foreground", "blue",
542 "family", "MonoSpace", NULL);
543 logwin->color_tags[LOG_WARN] = gtk_text_buffer_create_tag (buffer,
544 "orange_foreground", "foreground", "orange",
545 "family", "MonoSpace", NULL);
546 logwin->color_tags[LOG_ERROR] = gtk_text_buffer_create_tag (buffer,
547 "red_foreground", "foreground", "red",
548 "family", "MonoSpace", NULL);
551 static void log_window_show(LogWindow *logwin)
553 GtkTextView *text = GTK_TEXT_VIEW(logwin->text);
554 GtkTextBuffer *buffer;
558 buffer = gtk_text_view_get_buffer(text);
559 mark = gtk_text_buffer_get_mark(buffer, "end");
560 gtk_text_view_scroll_mark_onscreen(text, mark);
562 gtk_window_present(GTK_WINDOW(logwin->window));
564 log_window_append("", LOG_NORMAL); // to flush memorized lines
566 regexp = g_strdup(get_regexp());
567 if (regexp != nullptr)
569 gq_gtk_entry_set_text(GTK_ENTRY(logwin->regexp_box), regexp);
574 void log_window_new(LayoutWindow *lw)
576 if (logwindow == nullptr)
580 logwin = log_window_create(lw);
581 log_window_init(logwin);
585 log_window_show(logwindow);
590 LogMsg(const gchar *text, LogType type)
598 static void log_window_insert_text(GtkTextBuffer *buffer, GtkTextIter *iter,
599 const gchar *text, GtkTextTag *tag)
603 if (!text || !*text) return;
605 str_utf8 = utf8_validate_or_convert(text);
606 gtk_text_buffer_insert_with_tags(buffer, iter, str_utf8, -1, tag, NULL);
610 void log_window_append(const gchar *str, LogType type)
613 GtkTextBuffer *buffer;
615 static std::deque<LogMsg> memory;
617 if (logwindow == nullptr)
621 memory.emplace_front(str, type);
623 if (memory.size() >= static_cast<guint>(options->log_window_lines))
625 const auto count = std::max(options->log_window_lines - 1, 0);
627 memory.resize(count);
633 text = GTK_TEXT_VIEW(logwindow->text);
634 buffer = gtk_text_view_get_buffer(text);
636 if (options->log_window_lines > 0 && logwindow->lines >= options->log_window_lines)
638 GtkTextIter start, end;
640 gtk_text_buffer_get_start_iter(buffer, &start);
642 gtk_text_iter_forward_lines(&end, logwindow->lines - options->log_window_lines);
643 gtk_text_buffer_delete(buffer, &start, &end);
646 gtk_text_buffer_get_end_iter(buffer, &iter);
648 std::for_each(memory.crbegin(), memory.crend(), [buffer, &iter](const LogMsg &oldest_msg)
650 log_window_insert_text(buffer, &iter, oldest_msg.text.c_str(), logwindow->color_tags[oldest_msg.type]);
654 log_window_insert_text(buffer, &iter, str, logwindow->color_tags[type]);
656 if (!options->log_window.paused)
658 if (gtk_widget_get_visible(GTK_WIDGET(text)))
662 mark = gtk_text_buffer_get_mark(buffer, "end");
663 gtk_text_view_scroll_mark_onscreen(text, mark);
667 logwindow->lines = gtk_text_buffer_get_line_count(buffer);
669 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */