Skip to content

Commit

Permalink
[BUGFIX] Fixed address hilighting in dark mode (Issue #14)
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Jan 5, 2021
1 parent d3f5458 commit f84d804
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ifl.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,25 +587,27 @@ def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole) -> Any:
# --------------------------------------------------------------------------
# custom views:


COLOR_NORMAL = 0xFFFFFF


class FunctionsView_t(QtWidgets.QTableView):
"""The top view: listing all the functions.
"""

# private
def _get_default_color(self) -> None:
ea = idaapi.get_screen_ea()
seg = idaapi.getseg(ea)
return seg.color

def _set_segment_color(self, ea, color) -> None:
seg = idaapi.getseg(ea)
seg.color = COLOR_NORMAL
seg.color = color
seg.update()

# public
def __init__(self, dataManager, color_hilight, func_model, parent=None) -> None:
super(FunctionsView_t, self).__init__(parent=parent)
self.setSelectionMode(QtWidgets.QAbstractItemView.SingleSelection)
#
self.color_normal = self._get_default_color()
self.prev_addr = BADADDR
self.color_hilight = color_hilight
self.func_model = func_model
Expand All @@ -622,11 +624,11 @@ def currentChanged(self, current, previous) -> None:
def hilight_addr(self, addr: int) -> None:
if self.prev_addr != BADADDR:
ea = self.prev_addr
self._set_segment_color(ea, COLOR_NORMAL)
set_color(ea, CIC_ITEM, COLOR_NORMAL)
self._set_segment_color(ea, self.color_normal)
set_color(ea, CIC_ITEM, self.color_normal)
if addr != BADADDR:
ea = addr
self._set_segment_color(ea, COLOR_NORMAL)
self._set_segment_color(ea, self.color_normal)
set_color(addr, CIC_ITEM, self.color_hilight)
self.prev_addr = addr

Expand Down

0 comments on commit f84d804

Please sign in to comment.