Go back in the undo history n steps and call reevaluate() Note that in the program this is called "Rewind" because I want it to be clear that this is by no means a true undo implementation, it is merely a convenience bonus.
(self, n: int = 1)
| 1051 | return n |
| 1052 | |
| 1053 | def undo(self, n: int = 1) -> None: |
| 1054 | """Go back in the undo history n steps and call reevaluate() |
| 1055 | Note that in the program this is called "Rewind" because I |
| 1056 | want it to be clear that this is by no means a true undo |
| 1057 | implementation, it is merely a convenience bonus.""" |
| 1058 | if not self.history: |
| 1059 | return None |
| 1060 | |
| 1061 | self.interp.timer.reset_timer() |
| 1062 | |
| 1063 | if len(self.history) < n: |
| 1064 | n = len(self.history) |
| 1065 | |
| 1066 | entries = list(self.rl_history.entries) |
| 1067 | |
| 1068 | # Most recently undone command |
| 1069 | last_entries = self.history[-n:] |
| 1070 | last_entries.reverse() |
| 1071 | self.redo_stack += last_entries |
| 1072 | self.history = self.history[:-n] |
| 1073 | self.reevaluate() |
| 1074 | |
| 1075 | self.rl_history.entries = entries |
| 1076 | |
| 1077 | def flush(self) -> None: |
| 1078 | """Olivier Grisel brought it to my attention that the logging |
nothing calls this directly
no test coverage detected