- LString cur_cmd;
- ///
- enum{ MAX_HISTORY = 10 };
- ///
- LString history[MAX_HISTORY];
- ///
- int history_idx, history_cnt;
- ///
- void addHistory(LString const &cmd) {
- if (history_cnt==0 || (history_cnt>0 && cmd!=history[(history_cnt-1) % MAX_HISTORY])) {
- history[history_cnt % MAX_HISTORY] = cmd;
- history_cnt++;
- }
- history_idx = history_cnt;
- }
- ///
- LString getHistory() { return history[history_idx % MAX_HISTORY]; }