mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 06:32:42 +00:00
Add Ctrl+Backspace and Ctrl+Del to ui::Entry field (fix #769)
This commit is contained in:
parent
dc33cf754b
commit
9662c0cb90
@ -254,6 +254,8 @@ bool Entry::onProcessMessage(Message* msg)
|
||||
case kKeyDel:
|
||||
if (msg->shiftPressed())
|
||||
cmd = EntryCmd::Cut;
|
||||
else if (msg->ctrlPressed())
|
||||
cmd = EntryCmd::DeleteForwardToEndOfLine;
|
||||
else
|
||||
cmd = EntryCmd::DeleteForward;
|
||||
break;
|
||||
@ -266,7 +268,10 @@ bool Entry::onProcessMessage(Message* msg)
|
||||
break;
|
||||
|
||||
case kKeyBackspace:
|
||||
cmd = EntryCmd::DeleteBackward;
|
||||
if (msg->ctrlPressed())
|
||||
cmd = EntryCmd::DeleteBackwardWord;
|
||||
else
|
||||
cmd = EntryCmd::DeleteBackward;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -657,6 +662,18 @@ void Entry::executeCmd(EntryCmd cmd, int unicodeChar, bool shift_pressed)
|
||||
m_select = -1;
|
||||
break;
|
||||
|
||||
case EntryCmd::DeleteBackwardWord:
|
||||
m_select = m_caret;
|
||||
backwardWord();
|
||||
if (m_caret < m_select)
|
||||
text.erase(m_caret, m_select-m_caret);
|
||||
m_select = -1;
|
||||
break;
|
||||
|
||||
case EntryCmd::DeleteForwardToEndOfLine:
|
||||
text.erase(m_caret);
|
||||
break;
|
||||
|
||||
case EntryCmd::SelectAll:
|
||||
selectAllText();
|
||||
break;
|
||||
|
@ -16,8 +16,7 @@ namespace ui {
|
||||
|
||||
class MouseMessage;
|
||||
|
||||
class Entry : public Widget
|
||||
{
|
||||
class Entry : public Widget {
|
||||
public:
|
||||
Entry(std::size_t maxsize, const char *format, ...);
|
||||
~Entry();
|
||||
@ -67,6 +66,8 @@ namespace ui {
|
||||
EndOfLine,
|
||||
DeleteForward,
|
||||
DeleteBackward,
|
||||
DeleteBackwardWord,
|
||||
DeleteForwardToEndOfLine,
|
||||
Cut,
|
||||
Copy,
|
||||
Paste,
|
||||
|
Loading…
x
Reference in New Issue
Block a user