diff options
| author | Glenn Smith <glenn@vector35.com> | 2025-02-18 16:16:23 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-02-18 16:16:23 -0500 |
| commit | 5553126490179292488995883745344364507378 (patch) | |
| tree | 508b43f0da04328b1ae9abd573f209a10dfe8b5b /python | |
| parent | 9d6ca8c0d0ad9a1ce3b0b5eabf8c716d3c197896 (diff) | |
Add BinaryView.forget_undo_actions
Closes Vector35/binaryninja-api#6430
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 25 | ||||
| -rw-r--r-- | python/filemetadata.py | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index f9f955fe..96bac051 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -4306,6 +4306,31 @@ class BinaryView: """ self._file.commit_undo_actions(id) + def forget_undo_actions(self, id: Optional[str] = None) -> None: + """ + ``forget_undo_actions`` removes the actions taken since a call to :py:func:`begin_undo_actions` + Pass as `id` the value returned by :py:func:`begin_undo_actions`. Empty values of + `id` will remove all changes since the last call to :py:func:`begin_undo_actions`. + + :param Optional[str] id: id of undo state, from :py:func:`begin_undo_actions` + :rtype: None + :Example: + + >>> bv.get_disassembly(0x100012f1) + 'xor eax, eax' + >>> state = bv.begin_undo_actions() + >>> bv.convert_to_nop(0x100012f1) + True + >>> bv.forget_undo_actions(state) + >>> bv.get_disassembly(0x100012f1) + 'nop' + >>> bv.undo() + >>> bv.get_disassembly(0x100012f1) + 'nop' + >>> + """ + self._file.forget_undo_actions(id) + def revert_undo_actions(self, id: Optional[str] = None) -> None: """ ``revert_undo_actions`` reverts the actions taken since a call to :py:func:`begin_undo_actions` diff --git a/python/filemetadata.py b/python/filemetadata.py index a840bd78..e3357441 100644 --- a/python/filemetadata.py +++ b/python/filemetadata.py @@ -429,7 +429,7 @@ class FileMetadata: >>> state = bv.begin_undo_actions() >>> bv.convert_to_nop(0x100012f1) True - >>> bv.commit_undo_actions(state) + >>> bv.forget_undo_actions(state) >>> bv.get_disassembly(0x100012f1) 'nop' >>> bv.undo() |
