* Navigate Up/Down in the history of typed commands * @param direction Go further back in history (+1), go to recently typed commands (-1) */
| 474 | * @param direction Go further back in history (+1), go to recently typed commands (-1) |
| 475 | */ |
| 476 | static void IConsoleHistoryNavigate(int direction) |
| 477 | { |
| 478 | if (_iconsole_history.empty()) return; // Empty history |
| 479 | _iconsole_historypos = Clamp<ptrdiff_t>(_iconsole_historypos + direction, -1, _iconsole_history.size() - 1); |
| 480 | |
| 481 | if (_iconsole_historypos == -1) { |
| 482 | _iconsole_cmdline.DeleteAll(); |
| 483 | } else { |
| 484 | _iconsole_cmdline.Assign(_iconsole_history[_iconsole_historypos]); |
| 485 | } |
| 486 | _iconsole_tab_completion.Reset(); |
| 487 | } |
| 488 | |
| 489 | /** |
| 490 | * Handle the printing of text entered into the console or redirected there |