diff --git a/docs/index.html b/docs/index.html index 0ac22e5dd..0d2a8fd48 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1964,8 +1964,6 @@

UI Keys in Text Editing areas (cannot be remapped)

- *** TODO!!! *** - @@ -1973,34 +1971,128 @@ - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionKey (macOS)
Move cursor to beginning of lineHome, Control + aHome, Control + aMove cursor to previous characterLeft arrowLeft arrow
.........Move cursor to next characterRight arrowRight arrow
Move cursor to beginning of current wordControl + Left arrowOption + Left arrow
Move cursor to beginning of next wordControl + Right arrowOption + Right arrow
Move cursor to beginning of lineHomeHome, Control + a, Command + Left arrow
Move cursor to end of lineEndEnd, Control + e, Command + Right arrow
Delete character to left of cursorBackspaceBackspace
Delete character to right of cursorDelete, Control + dDelete, Control + d
Delete word to left of cursorControl + Backspace, Control + wOption + Backspace, Control + w
Delete word to right of cursorControl + Delete, Alt + dOption + Delete
Delete all text to beginning of lineControl + Home, Control + uCommand + Backspace, Control + u
Delete all text to end of lineControl + End, Control + kControl + k
Select character to left of cursorShift + Left arrowShift + Left arrow
Select character to right of cursorShift + Right arrowShift + Right arrow
Select all text to beginning of current wordShift-Control + Left arrowShift-Option + Left arrow
Select all text to beginning of next wordShift-Control + Right arrowShift-Option + Right arrow
Select all text to beginning of lineShift + HomeShift + Home, Shift-Control + a, Shift-Command + Left arrow
Select all text to end of lineShift + EndShift + End, Shift-Control + e, Shift-Command + Right arrow
Select all textControl + aCommand + a
Cut selected textControl + x, Shift + DeleteCommand + x
Copy selected textControl + c, Control + InsertCommand + c
Paste at cursor and replace selectionControl + v, Shift + InsertCommand + v
Undo last operationControl + zCommand + z
Redo last operationControl + y, Shift-Control + zCommand + y, Shift-Command + z

- - - - - - - - - - - - - - -
KeyEditor Function
Home, Control + aMove cursor to beginning of line
End, Control + eMove cursor to end of line
Delete, Control + dRemove character to right of cursor
BackspaceRemove character to left of cursor
Control + kRemove all characters from cursor to end of line
Control + uRemove all characters from cursor to beginning of line
Control + wRemove entire word to left of cursor
Control + Left arrowMove cursor to beginning of word to the left
Control + Right arrowMove cursor to beginning of word to the right
Control + c, Control + InsertCopy entire line to clipboard
Control + v, Shift + InsertPaste clipboard contents
Control + x, Shift + DeleteCut entire line to clipboard
-

Controller Map

diff --git a/src/common/PKeyboardHandler.cxx b/src/common/PKeyboardHandler.cxx index f6cf1a8ef..159a5d99f 100644 --- a/src/common/PKeyboardHandler.cxx +++ b/src/common/PKeyboardHandler.cxx @@ -693,9 +693,10 @@ PhysicalKeyboardHandler::FixedEditMapping = { {Event::SelectEnd, KBDK_END, KBDM_SHIFT}, {Event::SelectAll, KBDK_A, CMD}, {Event::Delete, KBDK_DELETE}, - {Event::DeleteChar, KBDK_D, KBDM_CTRL}, - {Event::DeleteWord, KBDK_W, KBDM_CTRL}, - {Event::DeleteWord, KBDK_BACKSPACE, OPTION}, + {Event::Delete, KBDK_D, KBDM_CTRL}, + {Event::DeleteLeftWord, KBDK_W, KBDM_CTRL}, + {Event::DeleteLeftWord, KBDK_BACKSPACE, OPTION}, + {Event::DeleteRightWord, KBDK_DELETE, OPTION}, {Event::DeleteHome, KBDK_U, KBDM_CTRL}, {Event::DeleteHome, KBDK_BACKSPACE, CMD}, {Event::DeleteEnd, KBDK_K, KBDM_CTRL}, @@ -718,17 +719,21 @@ PhysicalKeyboardHandler::FixedEditMapping = { {Event::SelectAll, KBDK_A, KBDM_CTRL}, {Event::Delete, KBDK_DELETE}, {Event::Delete, KBDK_KP_PERIOD}, - {Event::DeleteChar, KBDK_D, KBDM_CTRL}, - {Event::DeleteWord, KBDK_BACKSPACE, KBDM_CTRL}, - {Event::DeleteWord, KBDK_W, KBDM_CTRL}, + {Event::Delete, KBDK_D, KBDM_CTRL}, + {Event::DeleteLeftWord, KBDK_BACKSPACE, KBDM_CTRL}, + {Event::DeleteLeftWord, KBDK_W, KBDM_CTRL}, + {Event::DeleteRightWord, KBDK_DELETE, KBDM_CTRL}, + {Event::DeleteRightWord, KBDK_D, KBDM_ALT}, {Event::DeleteHome, KBDK_HOME, KBDM_CTRL}, {Event::DeleteHome, KBDK_U, KBDM_CTRL}, {Event::DeleteEnd, KBDK_END, KBDM_CTRL}, {Event::DeleteEnd, KBDK_K, KBDM_CTRL}, {Event::Backspace, KBDK_BACKSPACE}, {Event::Undo, KBDK_Z, KBDM_CTRL}, + {Event::Undo, KBDK_BACKSPACE, KBDM_ALT}, {Event::Redo, KBDK_Y, KBDM_CTRL}, {Event::Redo, KBDK_Z, KBDM_SHIFT | KBDM_CTRL}, + {Event::Redo, KBDK_BACKSPACE, KBDM_SHIFT | KBDM_ALT}, {Event::Cut, KBDK_X, KBDM_CTRL}, {Event::Cut, KBDK_DELETE, KBDM_SHIFT}, {Event::Cut, KBDK_KP_PERIOD, KBDM_SHIFT}, diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index 4f5a0abae..490f7b8a6 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -591,7 +591,7 @@ void PromptWidget::specialKeys(StellaKey key) killLine(-1); break; case KBDK_W: - killLastWord(); + killWord(); break; case KBDK_A: textSelectAll(); @@ -666,7 +666,7 @@ void PromptWidget::killLine(int direction) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void PromptWidget::killLastWord() +void PromptWidget::killWord() { int cnt = 0; bool space = true; diff --git a/src/debugger/gui/PromptWidget.hxx b/src/debugger/gui/PromptWidget.hxx index 925fee4e7..c1719fa1a 100644 --- a/src/debugger/gui/PromptWidget.hxx +++ b/src/debugger/gui/PromptWidget.hxx @@ -68,7 +68,7 @@ class PromptWidget : public Widget, public CommandSender void nextLine(); void killChar(int direction); void killLine(int direction); - void killLastWord(); + void killWord(); // Clipboard void textSelectAll(); diff --git a/src/emucore/Event.hxx b/src/emucore/Event.hxx index 87a609834..f348fbeff 100644 --- a/src/emucore/Event.hxx +++ b/src/emucore/Event.hxx @@ -140,7 +140,7 @@ class Event MoveHome, MoveEnd, SelectLeftChar, SelectRightChar, SelectLeftWord, SelectRightWord, SelectHome, SelectEnd, SelectAll, - Delete, DeleteChar, DeleteWord, DeleteHome, DeleteEnd, Backspace, + Delete, DeleteLeftWord, DeleteRightWord, DeleteHome, DeleteEnd, Backspace, Cut, Copy, Paste, Undo, Redo, AbortEdit, EndEdit, diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index 6f5db0f29..7bd6af8d5 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -197,34 +197,40 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod) handled = killSelectedText(); if(!handled) handled = killChar(-1); - if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id); + if(handled) + sendCommand(EditableWidget::kChangedCmd, key, _id); break; case Event::Delete: handled = killSelectedText(); if(!handled) handled = killChar(+1); - if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id); + if(handled) + sendCommand(EditableWidget::kChangedCmd, key, _id); break; - case Event::DeleteChar: - handled = killChar(+1); - if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id); + case Event::DeleteLeftWord: + handled = killWord(-1); + if(handled) + sendCommand(EditableWidget::kChangedCmd, key, _id); break; - case Event::DeleteWord: - handled = killLastWord(); - if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id); + case Event::DeleteRightWord: + handled = killWord(+1); + if(handled) + sendCommand(EditableWidget::kChangedCmd, key, _id); break; case Event::DeleteEnd: handled = killLine(+1); - if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id); + if(handled) + sendCommand(EditableWidget::kChangedCmd, key, _id); break; case Event::DeleteHome: handled = killLine(-1); - if(handled) sendCommand(EditableWidget::kChangedCmd, key, _id); + if(handled) + sendCommand(EditableWidget::kChangedCmd, key, _id); break; case Event::Cut: @@ -426,23 +432,27 @@ bool EditableWidget::killChar(int direction, bool addEdit) { if(_caretPos > 0) { - myUndoHandler->endChars(_editString); _caretPos--; - _editString.erase(_caretPos, 1); - handled = true; if(_selectSize < 0) _selectSize++; - if(addEdit) - myUndoHandler->doo(_editString); + handled = true; } } else if(direction == 1) // Delete next character (delete) + { + if(_caretPos < _editString.size()) + { + if(_selectSize > 0) + _selectSize--; + handled = true; + } + } + + if(handled) { myUndoHandler->endChars(_editString); _editString.erase(_caretPos, 1); - handled = true; - if(_selectSize > 0) - _selectSize--; + if(addEdit) myUndoHandler->doo(_editString); } @@ -453,75 +463,74 @@ bool EditableWidget::killChar(int direction, bool addEdit) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool EditableWidget::killLine(int direction) { - bool handled = false; + int count = 0; if(direction == -1) // erase from current position to beginning of line - { - int count = _caretPos; - if(count > 0) - { - for (int i = 0; i < count; i++) - killChar(-1, false); + count = _caretPos; + else if(direction == +1) // erase from current position to end of line + count = int(_editString.size()) - _caretPos; - handled = true; - // remove selection for removed text - if(_selectSize < 0) - _selectSize = 0; - myUndoHandler->doo(_editString); - } - } - else if(direction == 1) // erase from current position to end of line + if(count > 0) { - int count = int(_editString.size()) - _caretPos; - if(count > 0) - { - for (int i = 0; i < count; i++) - killChar(+1, false); + for(int i = 0; i < count; i++) + killChar(direction, false); - handled = true; - // remove selection for removed text - if(_selectSize > 0) - _selectSize = 0; - myUndoHandler->doo(_editString); - } + myUndoHandler->doo(_editString); + return true; } - return handled; + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool EditableWidget::killLastWord() +bool EditableWidget::killWord(int direction) { - bool handled = false; - int count = 0, currentPos = _caretPos; bool space = true; - while (currentPos > 0) - { - if (_editString[currentPos - 1] == ' ') - { - if (!space) - break; - } - else - space = false; + int count = 0, currentPos = _caretPos; - currentPos--; - count++; + if(direction == -1) // move to first character of previous word + { + while(currentPos > 0) + { + if(_editString[currentPos - 1] == ' ') + { + if(!space) + break; + } + else + space = false; + + currentPos--; + count++; + } + } + else if(direction == +1) // move to first character of next word + { + while(currentPos < int(_editString.size())) + { + if(currentPos && _editString[currentPos - 1] == ' ') + { + if(!space) + break; + } + else + space = false; + + currentPos++; + count++; + } } if(count > 0) { - for (int i = 0; i < count; i++) - killChar(-1, false); + for(int i = 0; i < count; i++) + killChar(direction, false); - handled = true; - // remove selection for removed word - if(_selectSize < 0) - _selectSize = std::min(_selectSize + count, 0); myUndoHandler->doo(_editString); + return true; } - return handled; + return false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/EditableWidget.hxx b/src/gui/EditableWidget.hxx index 6c3a1bda1..fda92ccdf 100644 --- a/src/gui/EditableWidget.hxx +++ b/src/gui/EditableWidget.hxx @@ -89,7 +89,7 @@ class EditableWidget : public Widget, public CommandSender // Line editing bool killChar(int direction, bool addEdit = true); bool killLine(int direction); - bool killLastWord(); + bool killWord(int direction); bool moveWord(int direction, bool select); bool killSelectedText(bool addEdit = true);