proper ctrl+backspace support
This commit is contained in:
parent
abf60508cd
commit
0f40db4ef9
@ -358,7 +358,12 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
else if (backingText.length() && cursor < (int)backingText.length())
|
else if (backingText.length() && cursor < (int)backingText.length())
|
||||||
{
|
{
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
backingText.erase(cursor, backingText.length()-cursor);
|
{
|
||||||
|
size_t stopChar;
|
||||||
|
stopChar = backingText.find_first_not_of(" .,!?\n", cursor);
|
||||||
|
stopChar = backingText.find_first_of(" .,!?\n", stopChar);
|
||||||
|
backingText.erase(cursor, stopChar-cursor);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
backingText.erase(cursor, 1);
|
backingText.erase(cursor, 1);
|
||||||
changed = true;
|
changed = true;
|
||||||
@ -380,8 +385,14 @@ void Textbox::OnVKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
{
|
{
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
{
|
{
|
||||||
backingText.erase(0, cursor);
|
size_t stopChar;
|
||||||
cursor = 0;
|
stopChar = backingText.substr(0, cursor).find_last_not_of(" .,!?\n");
|
||||||
|
if (stopChar == backingText.npos)
|
||||||
|
stopChar = -1;
|
||||||
|
else
|
||||||
|
stopChar = backingText.substr(0, stopChar).find_last_of(" .,!?\n");
|
||||||
|
backingText.erase(stopChar+1, cursor-(stopChar+1));
|
||||||
|
cursor = stopChar+1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user