in hexforge_modules/helper.py [0:0]
def get_highlighted_string_from_decompiler() -> str:
"""
Get the highlighted string from the decompiler view in IDA Pro.
:return: The highlighted string or an empty string if no text is highlighted.
"""
widget = ida_kernwin.get_current_widget()
if widget and ida_kernwin.get_widget_type(widget) == ida_kernwin.BWN_PSEUDOCODE:
vu = ida_hexrays.get_widget_vdui(widget)
if vu:
highlighted_text = ida_kernwin.get_highlight(vu.ct)
if highlighted_text:
return highlighted_text[0]
return ""