mirror of https://github.com/stella-emu/stella.git
parent
dac382d5bf
commit
ee0800f5ad
140
docs/index.html
140
docs/index.html
|
@ -1964,8 +1964,6 @@
|
|||
|
||||
<p><b>UI Keys in Text Editing areas (cannot be remapped)</b></p>
|
||||
|
||||
*** TODO!!! ***
|
||||
|
||||
<table BORDER=2 cellpadding=4>
|
||||
<tr>
|
||||
<th>Function</th>
|
||||
|
@ -1973,34 +1971,128 @@
|
|||
<th>Key (macOS)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Move cursor to beginning of line</td>
|
||||
<td>Home, Control + a</td>
|
||||
<td>Home, Control + a</td>
|
||||
<td>Move cursor to previous character</td>
|
||||
<td>Left arrow</td>
|
||||
<td>Left arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>...</td>
|
||||
<td>...</td>
|
||||
<td>...</td>
|
||||
<td>Move cursor to next character</td>
|
||||
<td>Right arrow</td>
|
||||
<td>Right arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Move cursor to beginning of current word</td>
|
||||
<td>Control + Left arrow</td>
|
||||
<td>Option + Left arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Move cursor to beginning of next word</td>
|
||||
<td>Control + Right arrow</td>
|
||||
<td>Option + Right arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Move cursor to beginning of line</td>
|
||||
<td>Home</td>
|
||||
<td>Home, Control + a, Command + Left arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Move cursor to end of line</td>
|
||||
<td>End</td>
|
||||
<td>End, Control + e, Command + Right arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Delete character to left of cursor</td>
|
||||
<td>Backspace</td>
|
||||
<td>Backspace</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Delete character to right of cursor</td>
|
||||
<td>Delete, Control + d</td>
|
||||
<td>Delete, Control + d</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Delete word to left of cursor</td>
|
||||
<td>Control + Backspace, Control + w</td>
|
||||
<td>Option + Backspace, Control + w</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Delete word to right of cursor</td>
|
||||
<td>Control + Delete, Alt + d</td>
|
||||
<td>Option + Delete</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Delete all text to beginning of line</td>
|
||||
<td>Control + Home, Control + u</td>
|
||||
<td>Command + Backspace, Control + u</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Delete all text to end of line</td>
|
||||
<td>Control + End, Control + k</td>
|
||||
<td>Control + k</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select character to left of cursor</td>
|
||||
<td>Shift + Left arrow</td>
|
||||
<td>Shift + Left arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select character to right of cursor</td>
|
||||
<td>Shift + Right arrow</td>
|
||||
<td>Shift + Right arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select all text to beginning of current word</td>
|
||||
<td>Shift-Control + Left arrow</td>
|
||||
<td>Shift-Option + Left arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select all text to beginning of next word</td>
|
||||
<td>Shift-Control + Right arrow</td>
|
||||
<td>Shift-Option + Right arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select all text to beginning of line</td>
|
||||
<td>Shift + Home</td>
|
||||
<td>Shift + Home, Shift-Control + a, Shift-Command + Left arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select all text to end of line</td>
|
||||
<td>Shift + End</td>
|
||||
<td>Shift + End, Shift-Control + e, Shift-Command + Right arrow</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Select all text</td>
|
||||
<td>Control + a</td>
|
||||
<td>Command + a</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Cut selected text</td>
|
||||
<td>Control + x, Shift + Delete</td>
|
||||
<td>Command + x</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Copy selected text</td>
|
||||
<td>Control + c, Control + Insert</td>
|
||||
<td>Command + c</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Paste at cursor and replace selection</td>
|
||||
<td>Control + v, Shift + Insert</td>
|
||||
<td>Command + v</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Undo last operation</td>
|
||||
<td>Control + z</td>
|
||||
<td>Command + z</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Redo last operation</td>
|
||||
<td>Control + y, Shift-Control + z</td>
|
||||
<td>Command + y, Shift-Command + z</td>
|
||||
</tr>
|
||||
</table>
|
||||
</br>
|
||||
|
||||
<table BORDER=2 cellpadding=4>
|
||||
<tr><th>Key</th><th>Editor Function</th></tr>
|
||||
<tr><td>Home, Control + a</td><td>Move cursor to beginning of line</td></tr>
|
||||
<tr><td>End, Control + e</td><td>Move cursor to end of line</td></tr>
|
||||
<tr><td>Delete, Control + d</td><td>Remove character to right of cursor</td></tr>
|
||||
<tr><td>Backspace</td><td>Remove character to left of cursor</td></tr>
|
||||
<tr><td>Control + k</td><td>Remove all characters from cursor to end of line</td></tr>
|
||||
<tr><td>Control + u</td><td>Remove all characters from cursor to beginning of line</td></tr>
|
||||
<tr><td>Control + w</td><td>Remove entire word to left of cursor</td></tr>
|
||||
<tr><td>Control + Left arrow</td><td>Move cursor to beginning of word to the left</td></tr>
|
||||
<tr><td>Control + Right arrow</td><td>Move cursor to beginning of word to the right</td></tr>
|
||||
<tr><td>Control + c, Control + Insert</td><td>Copy entire line to clipboard</td></tr>
|
||||
<tr><td>Control + v, Shift + Insert</td><td>Paste clipboard contents</td></tr>
|
||||
<tr><td>Control + x, Shift + Delete</td><td>Cut entire line to clipboard</td></tr>
|
||||
</table>
|
||||
|
||||
</blockquote></br>
|
||||
|
||||
<h2><b><a name="ControlMap">Controller Map</a></b></h2>
|
||||
|
|
|
@ -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},
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue