Skip to content

Commit

Permalink
CodeEdit: Support toggling float display. (#1124)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfish authored Nov 16, 2023
1 parent 515bc1b commit e100d30
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions angrmanagement/ui/widgets/qccode_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ def neg_constant(self):
self._selected_node.fmt_neg ^= True
self._code_view.codegen.am_event()

def float_constant(self):
if hasattr(self._selected_node, "fmt_float"):
self._selected_node.fmt_float ^= True
self._code_view.codegen.am_event()

def convert_to_ite_expr(self):
node = self._selected_node
if not isinstance(node, CExpression):
Expand Down Expand Up @@ -600,6 +605,8 @@ def _initialize_context_menus(self):
self.action_char = QAction("Toggle char", self)
self.action_char.triggered.connect(self.char_constant)
self.action_char.setShortcut(QKeySequence("R"))
self.action_float = QAction("Toggle float", self)
self.action_float.triggered.connect(self.float_constant)
self.action_to_ite_expr = QAction("Create a ternary expression")
self.action_to_ite_expr.triggered.connect(self.convert_to_ite_expr)
self.action_swap_binop_operands = QAction("Swap operands")
Expand Down Expand Up @@ -629,6 +636,7 @@ def _initialize_context_menus(self):
self.action_hex,
self.action_neg,
self.action_char,
self.action_float,
]

self.call_actions = [self.action_rename_node, self.action_xref]
Expand Down

0 comments on commit e100d30

Please sign in to comment.