From: Patrick Steinhardt Date: Mon, 19 Jun 2017 05:41:49 +0000 (+0200) Subject: history: skip adding items if history is disabled X-Git-Url: https://git.owens.tech/editable-focus.html/editable-focus.html/git?a=commitdiff_plain;h=934afeb503c4bc0c3d73ac67aaa7c4987105f27a;p=vimb.git history: skip adding items if history is disabled Previous to the migration to webkit2gtk, history items were not added when either "history-max-items" was set to "0" or if a command was not inserted by typing, but for example triggered by "au" commands. Right now, though, this code is #ifdef'd out, so we'll always add items to the history. While we currently have no easy way of determining whether a command was typed or not, we should still refuse adding history items whenever the "history-max-items" variable is set to "0". As "au"-triggered commands are not yet supported again, we do not even have to worry about this case right now, but only later on when it is added. So we fix the issue now by returning early when `history_max` is not set. --- diff --git a/src/history.c b/src/history.c index e6cfc73..1708dc1 100644 --- a/src/history.c +++ b/src/history.c @@ -55,13 +55,10 @@ void history_add(Client *c, HistoryType type, const char *value, const char *add { const char *file; -#if 0 - /* Don't write a history entry if the history max size is set to 0. Else - * skip command history in case the command was not typed by the user. */ - if (!vb.config.history_max || (!vb.state.typed && type == HISTORY_COMMAND)) { + /* Don't write a history entry if the history max size is set to 0. */ + if (!vb.config.history_max) { return; } -#endif file = HIST_FILE(type); if (additional) {