1204 debugger long input crash (#1213)

* Debugger: Clamp long input
* Fix backspace when input line has 78 characters
* Colorize console error line
* Cleanup alignment
* Init
* Refactor common expression
* Add support for a long input line when we decide to enable it
* Unabbreviate SOL and EOL
This commit is contained in:
Michael "Code Poet" Pohoreski
2023-04-24 20:00:08 -07:00
committed by GitHub
parent a140946a23
commit f8da683d45
4 changed files with 48 additions and 18 deletions

View File

@@ -80,11 +80,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
char g_aConsoleInput[ CONSOLE_WIDTH ]; // = g_aConsoleDisplay[0];
// Cooked input line (no prompt)
int g_nConsoleInputChars = 0;
char * g_pConsoleInput = 0; // points to past prompt
const char * g_pConsoleFirstArg = 0; // points to first arg
bool g_bConsoleInputQuoted = false; // Allows lower-case to be entered
char g_nConsoleInputSkip = '~';
int g_nConsoleInputChars = 0;
char * g_pConsoleInput = 0; // points to past prompt
int g_nConsoleInputMaxLen = 0;
int g_nConsoleInputScrollWidth = 0;
const char * g_pConsoleFirstArg = 0; // points to first arg
bool g_bConsoleInputQuoted = false; // Allows lower-case to be entered
char g_nConsoleInputSkip = '~';
// Prototypes _______________________________________________________________
@@ -354,7 +356,7 @@ void ConsoleConvertFromText ( conchar_t * sText, const char * pText )
//===========================================================================
Update_t ConsoleDisplayError ( const char * pText )
{
ConsoleBufferPush( pText );
ConsolePrintFormat( CHC_ERROR "%s", pText );
return ConsoleUpdate();
}
@@ -430,7 +432,7 @@ bool ConsoleInputBackSpace ()
{
if (g_nConsoleInputChars)
{
g_pConsoleInput[ g_nConsoleInputChars ] = CHAR_SPACE;
g_pConsoleInput[ g_nConsoleInputChars ] = 0;
g_nConsoleInputChars--;
@@ -461,7 +463,7 @@ bool ConsoleInputClear ()
//===========================================================================
bool ConsoleInputChar ( char ch )
{
if (g_nConsoleInputChars < g_nConsoleDisplayWidth) // bug? include prompt?
if (g_nConsoleInputChars < g_nConsoleInputMaxLen) // GH #1204 Need to count the space at EOL for the cursor
{
g_pConsoleInput[ g_nConsoleInputChars ] = ch;
g_nConsoleInputChars++;