Text input is now working in the debugger prompt (a rewrite of the

PromptWidget class to use EditableWidget will probably happen after
release 4.0).

All text input now seems to be working as in Stella 3.9.3.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2915 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-06-10 21:53:02 +00:00
parent aa6c1b3d58
commit 53edeb9171
2 changed files with 22 additions and 31 deletions

View File

@ -139,14 +139,18 @@ void PromptWidget::printPrompt()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PromptWidget::handleText(char text) bool PromptWidget::handleText(char text)
{ {
for(int i = _promptEndPos - 1; i >= _currentPos; i--)
buffer(i + 1) = buffer(i);
_promptEndPos++;
putchar(text);
scrollToCurrent();
return false; return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod) bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
{ {
int i;
bool handled = true; bool handled = true;
bool dirty = false; bool dirty = false;
@ -164,7 +168,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
{ {
// Copy the user input to command // Copy the user input to command
string command; string command;
for (i = 0; i < len; i++) for (int i = 0; i < len; i++)
command += buffer(_promptStartPos + i) & 0x7f; command += buffer(_promptStartPos + i) & 0x7f;
// Add the input to the history // Add the input to the history
@ -207,7 +211,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
char delimiter = '\0'; char delimiter = '\0';
char str[256]; char str[256];
for (i = 0; i < len; i++) for (int i = 0; i < len; i++)
{ {
str[i] = buffer(_promptStartPos + i) & 0x7f; str[i] = buffer(_promptStartPos + i) & 0x7f;
if(strchr("{*@<> ", str[i]) != NULL ) if(strchr("{*@<> ", str[i]) != NULL )
@ -279,7 +283,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
_promptStartPos = _currentPos; _promptStartPos = _currentPos;
for(i=0; i<lastDelimPos; i++) for(int i = 0; i < lastDelimPos; i++)
putcharIntern(str[i]); putcharIntern(str[i]);
if(lastDelimPos > 0) if(lastDelimPos > 0)
@ -416,16 +420,6 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
else if (instance().eventHandler().kbdAlt(mod)) else if (instance().eventHandler().kbdAlt(mod))
{ {
} }
#if 0
else if (isprint(ascii))
{
for (i = _promptEndPos - 1; i >= _currentPos; i--)
buffer(i + 1) = buffer(i);
_promptEndPos++;
putchar(ascii);
scrollToCurrent();
}
#endif
else else
handled = false; handled = false;
break; break;
@ -525,35 +519,32 @@ int PromptWidget::getWidth() const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PromptWidget::specialKeys(int keycode) void PromptWidget::specialKeys(StellaKey key)
{ {
bool handled = false; bool handled = true;
switch (keycode) switch(key)
{ {
case 'a': case KBDK_A:
_currentPos = _promptStartPos; _currentPos = _promptStartPos;
handled = true;
break; break;
case 'd': case KBDK_D:
killChar(+1); killChar(+1);
handled = true;
break; break;
case 'e': case KBDK_E:
_currentPos = _promptEndPos; _currentPos = _promptEndPos;
handled = true;
break; break;
case 'k': case KBDK_K:
killLine(+1); killLine(+1);
handled = true;
break; break;
case 'u': case KBDK_U:
killLine(-1); killLine(-1);
handled = true;
break; break;
case 'w': case KBDK_W:
killLastWord(); killLastWord();
handled = true; break;
default:
handled = false;
break; break;
} }

View File

@ -58,7 +58,7 @@ class PromptWidget : public Widget, public CommandSender
void scrollToCurrent(); void scrollToCurrent();
// Line editing // Line editing
void specialKeys(int keycode); void specialKeys(StellaKey key);
void nextLine(); void nextLine();
void killChar(int direction); void killChar(int direction);
void killLine(int direction); void killLine(int direction);