# HG changeset patch # User Colin Clark # Date 1497780189 -3600 # Node ID d01e5b8e80d9e8d8a42afa7a6a415dcf80cae37c # Parent 130acea2daa0d1b68598874c0eaab5c88fcfc9ee Eliminate FIXME: Log window line limit Set log window line limit in Preferences/Behavior diff -r 130acea2daa0 -r d01e5b8e80d9 doc/docbook/GuideOptionsBehavior.xml --- a/doc/docbook/GuideOptionsBehavior.xml Sat Jun 17 09:14:58 2017 +0100 +++ b/doc/docbook/GuideOptionsBehavior.xml Sun Jun 18 11:03:09 2017 +0100 @@ -196,6 +196,14 @@ Displayed when compiled with the option --enable-debug-log. This defines the verbosity of debug info sent to console and log window (0 disables the debug output). + + + Log Window max. lines + + + The maximum number of data lines to be displayed. The window will show the most recent data. + + diff -r 130acea2daa0 -r d01e5b8e80d9 src/logwindow.c --- a/src/logwindow.c Sat Jun 17 09:14:58 2017 +0100 +++ b/src/logwindow.c Sun Jun 18 11:03:09 2017 +0100 @@ -220,7 +220,6 @@ GtkTextView *text; GtkTextBuffer *buffer; GtkTextIter iter; - guint line_limit = 1000; //FIXME: option static GList *memory = NULL; if (logwindow == NULL) @@ -233,7 +232,7 @@ memory = g_list_prepend(memory, msg); - while (g_list_length(memory) >= line_limit) + while (g_list_length(memory) >= options->log_window_lines) { GList *work = g_list_last(memory); LogMsg *oldest_msg = work->data; @@ -248,13 +247,13 @@ text = GTK_TEXT_VIEW(logwindow->text); buffer = gtk_text_view_get_buffer(text); - if (line_limit > 0 && logwindow->lines >= line_limit) + if (options->log_window_lines > 0 && logwindow->lines >= options->log_window_lines) { GtkTextIter start, end; gtk_text_buffer_get_start_iter(buffer, &start); end = start; - gtk_text_iter_forward_lines(&end, logwindow->lines - line_limit); + gtk_text_iter_forward_lines(&end, logwindow->lines - options->log_window_lines); gtk_text_buffer_delete(buffer, &start, &end); } diff -r 130acea2daa0 -r d01e5b8e80d9 src/options.c --- a/src/options.c Sat Jun 17 09:14:58 2017 +0100 +++ b/src/options.c Sun Jun 18 11:03:09 2017 +0100 @@ -170,6 +170,8 @@ options->stereo.fixed_x2 = 0; options->stereo.fixed_y2 = 1125; + options->log_window_lines = 1000; + return options; } diff -r 130acea2daa0 -r d01e5b8e80d9 src/options.h --- a/src/options.h Sat Jun 17 09:14:58 2017 +0100 +++ b/src/options.h Sun Jun 18 11:03:09 2017 +0100 @@ -54,6 +54,8 @@ gboolean use_saved_window_positions_for_new_windows; gboolean tools_restore_state; + guint log_window_lines; + /* info sidebar component heights */ struct { gint height; diff -r 130acea2daa0 -r d01e5b8e80d9 src/preferences.c --- a/src/preferences.c Sat Jun 17 09:14:58 2017 +0100 +++ b/src/preferences.c Sun Jun 18 11:03:09 2017 +0100 @@ -2196,6 +2196,9 @@ pref_spin_new_int(group, _("Debug level:"), NULL, DEBUG_LEVEL_MIN, DEBUG_LEVEL_MAX, 1, get_debug_level(), &debug_c); + + pref_spin_new_int(group, _("Log Window max. lines:"), NULL, + 1, 99999, 1, options->log_window_lines, &options->log_window_lines); #endif } diff -r 130acea2daa0 -r d01e5b8e80d9 src/rcfile.c --- a/src/rcfile.c Sat Jun 17 09:14:58 2017 +0100 +++ b/src/rcfile.c Sun Jun 18 11:03:09 2017 +0100 @@ -335,6 +335,8 @@ WRITE_NL(); WRITE_BOOL(*options, use_saved_window_positions_for_new_windows); WRITE_NL(); WRITE_BOOL(*options, tools_restore_state); + WRITE_NL(); WRITE_UINT(*options, log_window_lines); + /* File operations Options */ WRITE_NL(); WRITE_BOOL(*options, file_ops.enable_in_place_rename); WRITE_NL(); WRITE_BOOL(*options, file_ops.confirm_delete); @@ -629,6 +631,8 @@ if (READ_BOOL(*options, use_saved_window_positions_for_new_windows)) continue; if (READ_BOOL(*options, tools_restore_state)) continue; + if (READ_UINT(*options, log_window_lines)) continue; + /* Properties dialog options */ if (READ_CHAR(*options, properties.tabs_order)) continue;