I know there is a lot of information out there on a undo/redo text type editor and I have read through quite them but still lack understanding of how to apply it to my code.
I'm using a linked list to hold a first part of the sentence and every word after the first part is entered can be added, removed, undone or redone to the linked list.
Pushing the command and word during an add I understand, manipulation of the undo and redo I understand.
When I perform an add or delete command, the redo stack is to be empty.
What I don't understand is how to push the command and data to be deleted from the list onto the undo stack.
The snippet of code I'm working with is as follows:
case "delete"://removes linked list node with the string specified on undo stack.
if(!undo.isEmpty()){
undo.topAndPop();//removes the previous command/choice off the undo stack.
temp = undo.top();//reads the data on the next stack segment after the command is gone.
readme.listRemove(temp);//removes the data from the linked list.
undo.pop();//removes the tos data
redo.makeEmpty();//empties redo stack.
}else break;
break;