summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/config.c1
-rw-r--r--include/settings.h3
-rw-r--r--source/history.c4
-rw-r--r--source/xrmoptions.c2
4 files changed, 7 insertions, 3 deletions
diff --git a/config/config.c b/config/config.c
index 501ea008..422311ef 100644
--- a/config/config.c
+++ b/config/config.c
@@ -141,4 +141,5 @@ Settings config = {
.color_urgent = NULL,
.color_window = NULL,
.plugin_path = PLUGIN_PATH,
+ .max_history_size = 25,
};
diff --git a/include/settings.h b/include/settings.h
index 295a8cd0..10a5fc4c 100644
--- a/include/settings.h
+++ b/include/settings.h
@@ -157,6 +157,9 @@ typedef struct
char *theme;
/** Path where plugins can be found. */
char * plugin_path;
+
+ /** Maximum history length per mode. */
+ unsigned int max_history_size;
} Settings;
/** Global Settings structure. */
extern Settings config;
diff --git a/source/history.c b/source/history.c
index 6b4a9794..4966ffe2 100644
--- a/source/history.c
+++ b/source/history.c
@@ -38,8 +38,6 @@
#include "history.h"
#include "settings.h"
-#define HISTORY_MAX_ENTRIES 25
-
/**
* History element
*/
@@ -70,7 +68,7 @@ static void __history_write_element_list ( FILE *fd, _element **list, unsigned i
int min_value = list[length - 1]->index;
// Set the max length of the list.
- length = ( length > HISTORY_MAX_ENTRIES ) ? HISTORY_MAX_ENTRIES : length;
+ length = ( length > config.max_history_size ) ? config.max_history_size: length;
// Write out entries.
for ( unsigned int iter = 0; iter < length; iter++ ) {
diff --git a/source/xrmoptions.c b/source/xrmoptions.c
index 404886c4..74a95853 100644
--- a/source/xrmoptions.c
+++ b/source/xrmoptions.c
@@ -204,6 +204,8 @@ static XrmOption xrmOptions[] = {
"Color scheme window", CONFIG_DEFAULT },
{ xrm_String, "plugin-path", { .str = &config.plugin_path }, NULL,
"Directory containing plugins", CONFIG_DEFAULT },
+ { xrm_Number, "max-history-size", { .num = &config.max_history_size }, NULL,
+ "Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT },
};
/** Dynamic array of extra options */