summaryrefslogtreecommitdiff
path: root/python/binaryview.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2025-02-18 16:16:23 -0500
committerGlenn Smith <glenn@vector35.com>2025-02-18 16:16:23 -0500
commit5553126490179292488995883745344364507378 (patch)
tree508b43f0da04328b1ae9abd573f209a10dfe8b5b /python/binaryview.py
parent9d6ca8c0d0ad9a1ce3b0b5eabf8c716d3c197896 (diff)
Add BinaryView.forget_undo_actions
Closes Vector35/binaryninja-api#6430
Diffstat (limited to 'python/binaryview.py')
-rw-r--r--python/binaryview.py25
1 files changed, 25 insertions, 0 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`