equal
deleted
inserted
replaced
55 _iconsole_cmdline.caretxoffs = 0; |
55 _iconsole_cmdline.caretxoffs = 0; |
56 SetWindowDirty(_iconsole_win); |
56 SetWindowDirty(_iconsole_win); |
57 } |
57 } |
58 |
58 |
59 static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;} |
59 static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;} |
|
60 |
|
61 |
|
62 static void IConsoleHistoryAdd(const char* cmd); |
|
63 static void IConsoleHistoryNavigate(int direction); |
60 |
64 |
61 // ** console window ** // |
65 // ** console window ** // |
62 static void IConsoleWndProc(Window* w, WindowEvent* e) |
66 static void IConsoleWndProc(Window* w, WindowEvent* e) |
63 { |
67 { |
64 switch (e->event) { |
68 switch (e->event) { |
320 /** |
324 /** |
321 * Add the entered line into the history so you can look it back |
325 * Add the entered line into the history so you can look it back |
322 * scroll, etc. Put it to the beginning as it is the latest text |
326 * scroll, etc. Put it to the beginning as it is the latest text |
323 * @param cmd Text to be entered into the 'history' |
327 * @param cmd Text to be entered into the 'history' |
324 */ |
328 */ |
325 void IConsoleHistoryAdd(const char *cmd) |
329 static void IConsoleHistoryAdd(const char* cmd) |
326 { |
330 { |
327 free(_iconsole_history[ICON_HISTORY_SIZE - 1]); |
331 free(_iconsole_history[ICON_HISTORY_SIZE - 1]); |
328 |
332 |
329 memmove(&_iconsole_history[1], &_iconsole_history[0], sizeof(_iconsole_history[0]) * (ICON_HISTORY_SIZE - 1)); |
333 memmove(&_iconsole_history[1], &_iconsole_history[0], sizeof(_iconsole_history[0]) * (ICON_HISTORY_SIZE - 1)); |
330 _iconsole_history[0] = strdup(cmd); |
334 _iconsole_history[0] = strdup(cmd); |
333 |
337 |
334 /** |
338 /** |
335 * Navigate Up/Down in the history of typed commands |
339 * Navigate Up/Down in the history of typed commands |
336 * @param direction Go further back in history (+1), go to recently typed commands (-1) |
340 * @param direction Go further back in history (+1), go to recently typed commands (-1) |
337 */ |
341 */ |
338 void IConsoleHistoryNavigate(signed char direction) |
342 static void IConsoleHistoryNavigate(int direction) |
339 { |
343 { |
340 int i = _iconsole_historypos + direction; |
344 int i = _iconsole_historypos + direction; |
341 |
345 |
342 // watch out for overflows, just wrap around |
346 // watch out for overflows, just wrap around |
343 if (i < 0) i = ICON_HISTORY_SIZE - 1; |
347 if (i < 0) i = ICON_HISTORY_SIZE - 1; |
685 * Execute it as well. |
689 * Execute it as well. |
686 * @param *alias is the alias of the command |
690 * @param *alias is the alias of the command |
687 * @param tokencount the number of parameters passed |
691 * @param tokencount the number of parameters passed |
688 * @param *tokens are the parameters given to the original command (0 is the first param) |
692 * @param *tokens are the parameters given to the original command (0 is the first param) |
689 */ |
693 */ |
690 void IConsoleAliasExec(const IConsoleAlias *alias, byte tokencount, char *tokens[ICON_TOKEN_COUNT]) |
694 static void IConsoleAliasExec(const IConsoleAlias* alias, byte tokencount, char* tokens[ICON_TOKEN_COUNT]) |
691 { |
695 { |
692 const char *cmdptr; |
696 const char *cmdptr; |
693 char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE]; |
697 char *aliases[ICON_MAX_ALIAS_LINES], aliasstream[ICON_MAX_STREAMSIZE]; |
694 int i; |
698 int i; |
695 uint a_index, astream_i; |
699 uint a_index, astream_i; |