history: skip adding items if history is disabled
authorPatrick Steinhardt <ps@pks.im>
Mon, 19 Jun 2017 05:41:49 +0000 (07:41 +0200)
committerPatrick Steinhardt <ps@pks.im>
Mon, 19 Jun 2017 05:47:55 +0000 (07:47 +0200)
commit934afeb503c4bc0c3d73ac67aaa7c4987105f27a
tree23a03b79afe923717ecdf403b21bdc0fca8c06fa
parentdb9a7e210efd2377d24ab8852fb7b7f4f8fadaec
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.
src/history.c