NeoMutt  2020-06-26-89-g172cd3
Teaching an old dog new tricks
DOXYGEN
Read/write command history from/to a file

Read/write command history from/to a file.

This history ring grows from 0..C_History, with last marking the where new entries go:

0 the oldest entry in the ring
1 entry
...
x-1 most recently entered text
last-> x NULL (this will be overwritten next)
x+1 NULL
...
#C_History NULL

Once the array fills up, it is used as a ring. last points where a new entry will go. Older entries are "up", and wrap around:

0 entry
1 entry
...
y-1 most recently entered text
last-> y entry (this will be overwritten next)
y+1 the oldest entry in the ring
...
#C_History entry

When $history_remove_dups is set, duplicate entries are scanned and removed each time a new entry is added. In order to preserve the history ring size, entries 0..last are compacted up. Entries last+1..C_History are compacted down:

0 entry
1 entry
...
z-1 most recently entered text
last-> z entry (this will be overwritten next)
z+1 NULL
z+2 NULL
...
the oldest entry in the ring
next oldest entry
#C_History entry
Function Description
mutt_hist_add() Add a string to a history
mutt_hist_at_scratch() Is the current History position at the 'scratch' place?
mutt_hist_free() Free all the history lists
mutt_hist_init() Create a set of empty History ring buffers
mutt_hist_next() Get the next string in a History
mutt_hist_prev() Get the previous string in a History
mutt_hist_read_file() Read the History from a file
mutt_hist_reset_state() Move the 'current' position to the end of the History
mutt_hist_save_scratch() Save a temporary string to the History
mutt_hist_search() Find matches in a history list