bugfix: edit mappings removed identical emulation mappings

This commit is contained in:
thrust26 2020-11-06 21:34:30 +01:00
parent c3be71cd9f
commit ccf29fa9a5
2 changed files with 10 additions and 10 deletions

View File

@ -365,7 +365,7 @@ bool PhysicalKeyboardHandler::addMapping(Event::Type event, EventMode mode,
myKeyMap.erase(EventMode::kKeypadMode, key, mod);
myKeyMap.erase(EventMode::kCompuMateMode, key, mod);
}
else if(evMode != EventMode::kMenuMode)
else if(evMode != EventMode::kMenuMode && evMode != EventMode::kEditMode)
{
// erase identical mapping for kCommonMode
myKeyMap.erase(EventMode::kCommonMode, key, mod);

View File

@ -81,6 +81,7 @@ void EditableWidget::setEditable(bool editable, bool hiliteBG)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EditableWidget::lostFocusWidget()
{
myUndoHandler->reset();
_selectSize = 0;
}
@ -90,8 +91,8 @@ bool EditableWidget::tryInsertChar(char c, int pos)
if(_filter(tolower(c)))
{
killSelectedText();
_editString.insert(pos, 1, c);
myUndoHandler->doChar(); // aggregate single chars
_editString.insert(pos, 1, c);
return true;
}
return false;
@ -106,7 +107,6 @@ bool EditableWidget::handleText(char text)
if(tryInsertChar(text, _caretPos))
{
_caretPos++;
//_selectSize = 0;
sendCommand(EditableWidget::kChangedCmd, 0, _id);
setDirty();
return true;
@ -192,6 +192,13 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
_selectSize = -int(_editString.size());
break;
case Event::Backspace:
handled = killSelectedText();
if(!handled)
handled = killChar(-1);
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
break;
case Event::Delete:
handled = killSelectedText();
if(!handled)
@ -219,13 +226,6 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod)
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
break;
case Event::Backspace:
handled = killSelectedText();
if(!handled)
handled = killChar(-1);
if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id);
break;
case Event::Cut:
handled = cutSelectedText();
if(handled)