.RE
.TP
.B history-max-items (int)
-Maximum number of unique items stored in search-, command or URI history.
+Maximum number of unique items stored in search-, command or URI history. If
+history-max-items is set to 0, the history file will not be changed.
.TP
.B home-page (string)
Homepage that vimb opens if started without a URI.
{
const char *file;
GList *list;
+
+ /* don't cleanup the history file if history max size is 0 */
+ if (!vb.config.history_max) {
+ return;
+ }
+
for (HistoryType i = HISTORY_FIRST; i < HISTORY_LAST; i++) {
file = get_file_by_type(i);
list = load(file);
{
const char *file;
- if (!vb.state.enable_history) {
+ /* don't write a history entry to the file if history is disabled or
+ * history max size is set to 0 */
+ if (!vb.state.enable_history || !vb.config.history_max) {
return;
}
/* yes, the whole file is read and wen possible don not need all the
* lines, but this is easier to implement compared to reading the file
* line wise from ent to begining */
- char *line, **lines = util_get_lines(filename);
+ char *line, **lines;
void *value;
int len, num_items = 0;
- len = g_strv_length(lines);
+ /* return empty list if max items is 0 */
+ if (!max_items) {
+ return gl;
+ }
+
+ lines = util_get_lines(filename);
+ len = g_strv_length(lines);
if (!len) {
return gl;
}