aboutsummaryrefslogtreecommitdiffhomepage
path: root/history.h
blob: 9c54cda139a2206eb27adf701c36407ab5eb5e17 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/** \file history.h
  Prototypes for history functions, part of the user interface.
*/

#ifndef FISH_HISTORY_H
#define FISH_HISTORY_H

#include <wchar.h>

/**
   Init history library. The history file won't actually be loaded
   until the first time a history search is performed.
*/
void history_init();

/**
   Saves the new history to disc and frees all memory used by the history.
*/
void history_destroy();

/**
  Add a new history item to the bottom of the history, containing a
  copy of str. Remove any duplicates. Moves the current item past the
  end of the history list.
*/
void history_add( const wchar_t *str );

/**
  Find previous history item starting with str. If this moves before
  the start of the history, str is returned.
*/
const wchar_t *history_prev_match( const wchar_t *str );

/**
   Return the specified history at the specified index, or 0 if out of bounds. 0 is the index of the current commandline.
*/
wchar_t *history_get( int idx );


/**
   Move to first history item
*/
void history_first();

/**
   Make current point to last history item
*/
void history_reset();


/**
  Find next history item starting with str. If this moves past
  the end of the history, str is returned.  
*/
const wchar_t *history_next_match( const wchar_t *str);


/**
   Set the current mode name for history. Each application that uses
   the history has it's own mode. This must be called prior to any use
   of the history.
*/

void history_set_mode( const wchar_t *name );


/**
   Perform sanity checks
*/
void history_sanity_check();

#endif