-
Notifications
You must be signed in to change notification settings - Fork 34
/
wxCommandHistory.h
56 lines (42 loc) · 1.87 KB
/
wxCommandHistory.h
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
/*
* wxCommandHistory.h wx logo terminal command history module
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 <https://www.gnu.org/licenses/>.
*
*/
#ifndef WXCOMMANDHISTORY_H_INCLUDED_
#define WXCOMMANDHISTORY_H_INCLUDED_
class wxCommandHistory {
public:
wxCommandHistory(const int history_size);
~wxCommandHistory();
void handle_command_entered(const char *input_buffer, const int command_len);
char * handle_previous(const char *input_buffer, const int command_len);
char * handle_next(const char *input_buffer, const int command_len);
private:
void maybe_store_working_command(const char *input_buffer, const int command_len);
// Fixed-size circular buffer for storing command history.
char **m_command_history;
// The size of the history buffer (I.E. number of commands to remember).
int m_history_size;
// The index to write in to the command history buffer.
int m_history_in_index;
// The index to read out from the command history buffer.
int m_history_out_index;
// Scratch space to hold working command during history operations.
char *m_working_command;
// The depth of navigation in the command history, including the working command (if present).
int m_history_moves;
};
#endif /* WXCOMMANDHISTORY_H_INCLUDED_ */