def extra_cmt_changed(ea, line_idx, cmt):
# FIXME: persist state for extra_cmts in order to determine
# what the original value was before modification
oldcmt = internal.netnode.sup.get(ea, line_idx)
ctx = internal.comment.contents if idaapi.get_func(ea) else internal.comment.globals
MAX_ITEM_LINES = (idaapi.E_NEXT-idaapi.E_PREV) if idaapi.E_NEXT > idaapi.E_PREV else idaapi.E_PREV-idaapi.E_NEXT
prefix = (idaapi.E_PREV, idaapi.E_PREV+MAX_ITEM_LINES, '__extra_prefix__')
suffix = (idaapi.E_NEXT, idaapi.E_NEXT+MAX_ITEM_LINES, '__extra_suffix__')
for l,r,key in (prefix,suffix):
if l <= line_idx < r:
if oldcmt is None and cmt: ctx.inc(ea, key)
elif oldcmt and cmt is None: ctx.dec(ea, key)
continue
return
### function scope
评论列表
文章目录