Skip to content

Commit 179ef89

Browse files
committed
Fixed undo/redo counting as editing text.
1 parent 1056b63 commit 179ef89

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

InputField.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -697,23 +697,27 @@ end
697697

698698
-- @UX: Improve how the cursor and selection are restored on undo.
699699
local function undoEdit(field)
700-
if field.editHistoryIndex == 1 then return end
700+
if field.editHistoryIndex == 1 then return false end
701701

702702
finilizeHistoryGroup(field)
703703
applyHistoryState(field, -1)
704704

705705
field:resetBlinking()
706706
field:scrollToCursor()
707+
708+
return true
707709
end
708710

709711
local function redoEdit(field)
710-
if field.editHistoryIndex == #field.editHistory then return end
712+
if field.editHistoryIndex == #field.editHistory then return false end
711713

712714
finilizeHistoryGroup(field)
713715
applyHistoryState(field, 1)
714716

715717
field:resetBlinking()
716718
field:scrollToCursor()
719+
720+
return true
717721
end
718722

719723

@@ -2097,17 +2101,13 @@ local function action_undo(field, isRepeat)
20972101
if not field.editingEnabled then return false, false end
20982102

20992103
-- @Robustness: Filter and/or font filter could have changed after the last edit.
2100-
if field.type ~= "password" then undoEdit(field) end
2101-
2102-
return true, true
2104+
return true, (field.type ~= "password" and undoEdit(field))
21032105
end
21042106
local function action_redo(field, isRepeat)
21052107
if not field.editingEnabled then return false, false end
21062108

21072109
-- @Robustness: Filter and/or font filter could have changed after the last edit.
2108-
if field.type ~= "password" then redoEdit(field) end
2109-
2110-
return true, true
2110+
return true, (field.type ~= "password" and redoEdit(field))
21112111
end
21122112

21132113

0 commit comments

Comments
 (0)