fix backspace/delete history behaviour
This commit is contained in:
parent
93f20b1746
commit
65ca46b2da
@ -308,7 +308,6 @@ void TextBox::draw(const DrawContext& pctx, const Assets& assets) {
|
|||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
int lineY = label->getLineYOffset(line);
|
int lineY = label->getLineYOffset(line);
|
||||||
int lineHeight = font->getLineHeight() * label->getLineInterval();
|
|
||||||
|
|
||||||
batch->setColor(glm::vec4(1, 1, 1, 0.05f));
|
batch->setColor(glm::vec4(1, 1, 1, 0.05f));
|
||||||
if (showLineNumbers) {
|
if (showLineNumbers) {
|
||||||
@ -809,7 +808,7 @@ void TextBox::performEditingKeyboardEvents(keycode key) {
|
|||||||
if (caret > input.length()) {
|
if (caret > input.length()) {
|
||||||
caret = input.length();
|
caret = input.length();
|
||||||
}
|
}
|
||||||
historian->onErase(caret - 1, input.substr(caret - 1, caret));
|
historian->onErase(caret - 1, input.substr(caret - 1, 1));
|
||||||
input = input.substr(0, caret-1) + input.substr(caret);
|
input = input.substr(0, caret-1) + input.substr(caret);
|
||||||
setCaret(caret-1);
|
setCaret(caret-1);
|
||||||
if (validate()) {
|
if (validate()) {
|
||||||
@ -818,7 +817,7 @@ void TextBox::performEditingKeyboardEvents(keycode key) {
|
|||||||
}
|
}
|
||||||
} else if (key == keycode::DELETE) {
|
} else if (key == keycode::DELETE) {
|
||||||
if (!eraseSelected() && caret < input.length()) {
|
if (!eraseSelected() && caret < input.length()) {
|
||||||
historian->onErase(caret, input.substr(caret, caret + 1));
|
historian->onErase(caret, input.substr(caret, 1));
|
||||||
input = input.substr(0, caret) + input.substr(caret + 1);
|
input = input.substr(0, caret) + input.substr(caret + 1);
|
||||||
if (validate()) {
|
if (validate()) {
|
||||||
onInput();
|
onInput();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user