Open lithops-zty opened 3 hours ago
User should type in undo
and press <Enter>
to execute UndoCommand
. Assumption for the first 2 section is that we only implement undo. The 3rd section explains how we implement redo, after implementing undo
undo
is run, we can pop the top of the stack. (Assumption here is that we are only planning to implement undo.)This is not explicitly discussed yet, but I think we should go with option 1 since it is a universal method which is easier to implement.
stateList[stateList.length - 2]
stateList
(in backend), and cannot simply pop the "stack" (in the frontend).stateList
, then decrement when undo and increment when redo.stateList
, then we will delete everything from index+1
all the way to the end of the stateList
, before we add the new state that this modifying command producesundo
, we might go back too far in history and the pointer goes beyond the viewport of the command history windowOther points of discussion:
UI:
Backend: