mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-14 02:27:40 -04:00
Separated line histories for python and normal console modes
This commit is contained in:
@ -225,7 +225,6 @@ void pfConsole::Init( pfConsoleEngine *engine )
|
|||||||
fWorkingCursor = 0;
|
fWorkingCursor = 0;
|
||||||
|
|
||||||
memset( fHistory, 0, sizeof( fHistory ) );
|
memset( fHistory, 0, sizeof( fHistory ) );
|
||||||
fHistoryCursor = fHistoryRecallCursor = 0;
|
|
||||||
|
|
||||||
fEffectCounter = 0;
|
fEffectCounter = 0;
|
||||||
fMode = 0;
|
fMode = 0;
|
||||||
@ -626,11 +625,11 @@ void pfConsole::IHandleKey( plKeyEventMsg *msg )
|
|||||||
}
|
}
|
||||||
else if( msg->GetKeyCode() == KEY_UP )
|
else if( msg->GetKeyCode() == KEY_UP )
|
||||||
{
|
{
|
||||||
i = ( fHistoryRecallCursor > 0 ) ? fHistoryRecallCursor - 1 : kNumHistoryItems - 1;
|
i = ( fHistory[ fPythonMode ].fRecallCursor > 0 ) ? fHistory[ fPythonMode ].fRecallCursor - 1 : kNumHistoryItems - 1;
|
||||||
if( fHistory[ i ][ 0 ] != 0 )
|
if( fHistory[ fPythonMode ].fData[ i ][ 0 ] != 0 )
|
||||||
{
|
{
|
||||||
fHistoryRecallCursor = i;
|
fHistory[ fPythonMode ].fRecallCursor = i;
|
||||||
strcpy( fWorkingLine, fHistory[ fHistoryRecallCursor ] );
|
strcpy( fWorkingLine, fHistory[ fPythonMode ].fData[ fHistory[ fPythonMode ].fRecallCursor ] );
|
||||||
findAgain = false;
|
findAgain = false;
|
||||||
findCounter = 0;
|
findCounter = 0;
|
||||||
fWorkingCursor = strlen( fWorkingLine );
|
fWorkingCursor = strlen( fWorkingLine );
|
||||||
@ -639,18 +638,18 @@ void pfConsole::IHandleKey( plKeyEventMsg *msg )
|
|||||||
}
|
}
|
||||||
else if( msg->GetKeyCode() == KEY_DOWN )
|
else if( msg->GetKeyCode() == KEY_DOWN )
|
||||||
{
|
{
|
||||||
if( fHistoryRecallCursor != fHistoryCursor )
|
if( fHistory[ fPythonMode ].fRecallCursor != fHistory[ fPythonMode ].fCursor )
|
||||||
{
|
{
|
||||||
i = ( fHistoryRecallCursor < kNumHistoryItems - 1 ) ? fHistoryRecallCursor + 1 : 0;
|
i = ( fHistory[ fPythonMode ].fRecallCursor < kNumHistoryItems - 1 ) ? fHistory[ fPythonMode ].fRecallCursor + 1 : 0;
|
||||||
if( i != fHistoryCursor )
|
if( i != fHistory[ fPythonMode ].fCursor )
|
||||||
{
|
{
|
||||||
fHistoryRecallCursor = i;
|
fHistory[ fPythonMode ].fRecallCursor = i;
|
||||||
strcpy( fWorkingLine, fHistory[ fHistoryRecallCursor ] );
|
strcpy( fWorkingLine, fHistory[ fPythonMode ].fData[ fHistory[ fPythonMode ].fRecallCursor ] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
memset( fWorkingLine, 0, sizeof( fWorkingLine ) );
|
memset( fWorkingLine, 0, sizeof( fWorkingLine ) );
|
||||||
fHistoryRecallCursor = fHistoryCursor;
|
fHistory[ fPythonMode ].fRecallCursor = fHistory[ fPythonMode ].fCursor;
|
||||||
}
|
}
|
||||||
findAgain = false;
|
findAgain = false;
|
||||||
findCounter = 0;
|
findCounter = 0;
|
||||||
@ -726,9 +725,9 @@ void pfConsole::IHandleKey( plKeyEventMsg *msg )
|
|||||||
if( fWorkingLine[ 0 ] != 0 )
|
if( fWorkingLine[ 0 ] != 0 )
|
||||||
{
|
{
|
||||||
// Save to history
|
// Save to history
|
||||||
strcpy( fHistory[ fHistoryCursor ], fWorkingLine );
|
strcpy( fHistory[ fPythonMode ].fData[ fHistory[ fPythonMode ].fCursor ], fWorkingLine );
|
||||||
fHistoryCursor = ( fHistoryCursor < kNumHistoryItems - 1 ) ? fHistoryCursor + 1 : 0;
|
fHistory[ fPythonMode ].fCursor = ( fHistory[ fPythonMode ].fCursor < kNumHistoryItems - 1 ) ? fHistory[ fPythonMode ].fCursor + 1 : 0;
|
||||||
fHistoryRecallCursor = fHistoryCursor;
|
fHistory[ fPythonMode ].fRecallCursor = fHistory[ fPythonMode ].fCursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// EXECUTE!!! (warning: DESTROYS fWorkingLine)
|
// EXECUTE!!! (warning: DESTROYS fWorkingLine)
|
||||||
@ -772,10 +771,10 @@ void pfConsole::IHandleKey( plKeyEventMsg *msg )
|
|||||||
for ( i=fPythonMultiLines; i>0 ; i--)
|
for ( i=fPythonMultiLines; i>0 ; i--)
|
||||||
{
|
{
|
||||||
// reach back in the history and find this line and paste it in here
|
// reach back in the history and find this line and paste it in here
|
||||||
int recall = fHistoryCursor - i;
|
int recall = fHistory[ fPythonMode ].fCursor - i;
|
||||||
if ( recall < 0 )
|
if ( recall < 0 )
|
||||||
recall += kNumHistoryItems;
|
recall += kNumHistoryItems;
|
||||||
strcat(biglines,fHistory[ recall ]);
|
strcat(biglines,fHistory[ fPythonMode ].fData[ recall ]);
|
||||||
strcat(biglines,"\n");
|
strcat(biglines,"\n");
|
||||||
}
|
}
|
||||||
// now evaluate this mess they made
|
// now evaluate this mess they made
|
||||||
|
@ -76,6 +76,7 @@ class pfConsole : public hsKeyedObject
|
|||||||
enum Konstants
|
enum Konstants
|
||||||
{
|
{
|
||||||
kNumHistoryItems = 16,
|
kNumHistoryItems = 16,
|
||||||
|
kNumHistoryTypes = 2,
|
||||||
kModeHidden = 0,
|
kModeHidden = 0,
|
||||||
kModeSingleLine = 1,
|
kModeSingleLine = 1,
|
||||||
kModeFull = 2,
|
kModeFull = 2,
|
||||||
@ -100,8 +101,10 @@ class pfConsole : public hsKeyedObject
|
|||||||
short fCursorTicks;
|
short fCursorTicks;
|
||||||
uint32_t fMsgTimeoutTimer;
|
uint32_t fMsgTimeoutTimer;
|
||||||
|
|
||||||
char fHistory[ kNumHistoryItems ][ kMaxCharsWide ];
|
struct _fHistory {
|
||||||
uint32_t fHistoryCursor, fHistoryRecallCursor;
|
char fData[ kNumHistoryItems ][ kMaxCharsWide ];
|
||||||
|
uint32_t fCursor, fRecallCursor;
|
||||||
|
} fHistory[ kNumHistoryTypes ];
|
||||||
char *fDisplayBuffer;
|
char *fDisplayBuffer;
|
||||||
char fWorkingLine[ kWorkingLineSize ];
|
char fWorkingLine[ kWorkingLineSize ];
|
||||||
uint32_t fWorkingCursor;
|
uint32_t fWorkingCursor;
|
||||||
|
Reference in New Issue
Block a user