mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix: undo/redo also available when textbox is not editable
This commit is contained in:
parent
38c869e72f
commit
0df5684adf
1 changed files with 3 additions and 3 deletions
|
|
@ -484,7 +484,7 @@ void TextBox::erase(size_t start, size_t length) {
|
|||
setCaret(caret - length);
|
||||
}
|
||||
auto left = input.substr(0, start);
|
||||
auto right = input.substr(end);
|
||||
auto right = end >= input.length() ? L"" : input.substr(end);
|
||||
input = left + right;
|
||||
}
|
||||
|
||||
|
|
@ -1034,11 +1034,11 @@ void TextBox::keyPressed(Keycode key) {
|
|||
resetSelection();
|
||||
}
|
||||
}
|
||||
if (key == Keycode::Z) {
|
||||
if (editable && key == Keycode::Z) {
|
||||
historian->undo();
|
||||
refreshSyntax();
|
||||
}
|
||||
if (key == Keycode::Y) {
|
||||
if (editable && key == Keycode::Y) {
|
||||
historian->redo();
|
||||
refreshSyntax();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue