Read/write command history from/to a file. More...
#include <stdbool.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | HistoryEntry |
A line in the History menu. More... | |
Enumerations | |
enum | HistoryClass { HC_EXT_COMMAND , HC_ALIAS , HC_NEO_COMMAND , HC_FILE , HC_PATTERN , HC_OTHER , HC_MAILBOX , HC_MAX } |
Type to differentiate different histories. More... | |
enum | ExpandoDataHistory { ED_HIS_MATCH = 1 , ED_HIS_NUMBER } |
Expando UIDs for History. More... | |
Functions | |
void | mutt_hist_add (enum HistoryClass hclass, const char *str, bool save) |
Add a string to a history. | |
bool | mutt_hist_at_scratch (enum HistoryClass hclass) |
Is the current History position at the 'scratch' place? | |
void | mutt_hist_cleanup (void) |
Free all the history lists. | |
void | mutt_hist_init (void) |
Create a set of empty History ring buffers. | |
char * | mutt_hist_next (enum HistoryClass hclass) |
Get the next string in a History. | |
char * | mutt_hist_prev (enum HistoryClass hclass) |
Get the previous string in a History. | |
void | mutt_hist_read_file (void) |
Read the History from a file. | |
void | mutt_hist_reset_state (enum HistoryClass hclass) |
Move the 'current' position to the end of the History. | |
void | mutt_hist_save_scratch (enum HistoryClass hclass, const char *str) |
Save a temporary string to the History. | |
int | mutt_hist_search (const char *search_buf, enum HistoryClass hclass, char **matches) |
Find matches in a history list. | |
void | mutt_hist_complete (char *buf, size_t buflen, enum HistoryClass hclass) |
Complete a string from a history list. | |
int | main_hist_observer (struct NotifyCallback *nc) |
Notification that a Config Variable has change - Implements observer_t -. | |
void | dlg_history (char *buf, size_t buflen, char **matches, int match_count) |
Select an item from a history list -. | |
Read/write command history from/to a file.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file lib.h.
enum HistoryClass |
Type to differentiate different histories.
Saved lists of recently-used:
Enumerator | |
---|---|
HC_EXT_COMMAND | External commands. |
HC_ALIAS | Aliases. |
HC_NEO_COMMAND | NeoMutt commands. |
HC_FILE | Files. |
HC_PATTERN | Patterns. |
HC_OTHER | Miscellaneous strings. |
HC_MAILBOX | Mailboxes. |
HC_MAX |
Definition at line 49 of file lib.h.
enum ExpandoDataHistory |
Enumerator | |
---|---|
ED_HIS_MATCH | |
ED_HIS_NUMBER |
void mutt_hist_add | ( | enum HistoryClass | hclass, |
const char * | str, | ||
bool | save | ||
) |
Add a string to a history.
hclass | History to add to |
str | String to add |
save | Should the changes be saved to file immediately? |
Definition at line 490 of file history.c.
bool mutt_hist_at_scratch | ( | enum HistoryClass | hclass | ) |
Is the current History position at the 'scratch' place?
hclass | History to use |
true | History is at 'scratch' place |
The last entry in the history is used as a 'scratch' area. It can be overwritten as the user types and edits.
To get (back) to the scratch area, call mutt_hist_next(), mutt_hist_prev() or mutt_hist_reset_state().
Definition at line 652 of file history.c.
void mutt_hist_cleanup | ( | void | ) |
Free all the history lists.
Definition at line 445 of file history.c.
void mutt_hist_init | ( | void | ) |
Create a set of empty History ring buffers.
This just creates empty histories. To fill them, call mutt_hist_read_file().
Definition at line 472 of file history.c.
char * mutt_hist_next | ( | enum HistoryClass | hclass | ) |
Get the next string in a History.
hclass | History to choose |
ptr | Next string |
If there is no next string, and empty string will be returned.
Definition at line 530 of file history.c.
char * mutt_hist_prev | ( | enum HistoryClass | hclass | ) |
Get the previous string in a History.
hclass | History to choose |
ptr | Previous string |
If there is no previous string, and empty string will be returned.
Definition at line 558 of file history.c.
void mutt_hist_read_file | ( | void | ) |
Read the History from a file.
The file $history_file
is read and parsed into separate History ring buffers.
Definition at line 600 of file history.c.
void mutt_hist_reset_state | ( | enum HistoryClass | hclass | ) |
Move the 'current' position to the end of the History.
hclass | History to reset |
After calling mutt_hist_next() and mutt_hist_prev(), this function resets the current position ('cur' pointer).
Definition at line 586 of file history.c.
void mutt_hist_save_scratch | ( | enum HistoryClass | hclass, |
const char * | str | ||
) |
Save a temporary string to the History.
hclass | History to alter |
str | String to set |
Write a 'scratch' string into the History's current position. This is useful to preserver a user's edits.
Definition at line 669 of file history.c.
int mutt_hist_search | ( | const char * | search_buf, |
enum HistoryClass | hclass, | ||
char ** | matches | ||
) |
Find matches in a history list.
[in] | search_buf | String to find |
[in] | hclass | History list |
[out] | matches | All the matching lines |
num | Matches found |
Definition at line 416 of file history.c.
void mutt_hist_complete | ( | char * | buf, |
size_t | buflen, | ||
enum HistoryClass | hclass | ||
) |
Complete a string from a history list.
Definition at line 686 of file history.c.