Write whole debug cli command to history
Previously the command was being modified in place in order to find the command name. This was happening before saving to the history. Fixes #70
This commit is contained in:
		
							parent
							
								
									7b7a55899f
								
							
						
					
					
						commit
						ccf4f34e92
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		|  | @ -159,15 +159,12 @@ void CLI_process() | ||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
| 			// Only do command-related stuff if there was actually a command
 | 				// Add the command to the history
 | ||||||
| 			// Avoids clogging command history with blanks
 | 				CLI_saveHistory( CLILineBuffer ); | ||||||
| 
 | 
 | ||||||
| 				// Process the current line buffer
 | 				// Process the current line buffer
 | ||||||
| 				CLI_commandLookup(); | 				CLI_commandLookup(); | ||||||
| 
 | 
 | ||||||
| 				// Add the command to the history
 |  | ||||||
| 				CLI_saveHistory( CLILineBuffer ); |  | ||||||
| 
 |  | ||||||
| 				// Keep the array circular, discarding the older entries
 | 				// Keep the array circular, discarding the older entries
 | ||||||
| 				if ( CLIHistoryTail < CLIHistoryHead ) | 				if ( CLIHistoryTail < CLIHistoryHead ) | ||||||
| 					CLIHistoryHead = ( CLIHistoryHead + 1 ) % CLIMaxHistorySize; | 					CLIHistoryHead = ( CLIHistoryHead + 1 ) % CLIMaxHistorySize; | ||||||
|  | @ -425,6 +422,11 @@ inline void CLI_saveHistory( char *buff ) | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |         // Don't write empty lines to the history
 | ||||||
|  |         const char *cursor = buff; | ||||||
|  |         while (*cursor == ' ') { cursor++; } // advance past the leading whitespace
 | ||||||
|  |         if (*cursor == '\0') { return ; } | ||||||
|  | 
 | ||||||
| 	// Copy the line to the history
 | 	// Copy the line to the history
 | ||||||
| 	int i; | 	int i; | ||||||
| 	for (i = 0; i < CLILineBufferCurrent; i++) | 	for (i = 0; i < CLILineBufferCurrent; i++) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Eric Mertens
						Eric Mertens