aboutsummaryrefslogtreecommitdiffstats
path: root/idatui/drive.py
diff options
context:
space:
mode:
authorblasty <blasty@local>2026-08-06 15:11:54 +0200
committerblasty <blasty@local>2026-08-06 15:11:54 +0200
commitfcfdc8c941aeb87cc99c983146f553e03a5daa49 (patch)
tree0d1742fc5ee18b971dac92993c5f2fa5df31467f /idatui/drive.py
parentapp: 'o' cycles the literal under the cursor (diff)
downloadida-tui-fcfdc8c941aeb87cc99c983146f553e03a5daa49.tar.gz
ida-tui-fcfdc8c941aeb87cc99c983146f553e03a5daa49.tar.xz
ida-tui-fcfdc8c941aeb87cc99c983146f553e03a5daa49.zip
rpc: an opfmt verb, and 'drive fmt'
mode is cycle/back/show or an explicit format. 'show' reports the current format and the stops on offer without editing, which is what a driver needs: the rendered text alone can't be trusted (a listing read before an ARM/Thumb switch shows the old decoding). 'word' puts the cursor on a token first, so a literal can be named instead of steered to.
Diffstat (limited to 'idatui/drive.py')
-rw-r--r--idatui/drive.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/idatui/drive.py b/idatui/drive.py
index 531b558..b83a8ba 100644
--- a/idatui/drive.py
+++ b/idatui/drive.py
@@ -258,6 +258,25 @@ def cmd_define(c, args):
return "\n".join(out)
+def cmd_fmt(c, args):
+ """fmt [mode] [word] — how the literal under the cursor is DISPLAYED.
+
+ ``fmt`` alone cycles (IDA's 'o'); a mode name sets it outright. A trailing
+ word puts the cursor on that token first, so you can name the literal
+ instead of steering the column there.
+
+ fmt # cycle the literal under the cursor
+ fmt dec # show it in decimal
+ fmt hex 18h # find '18h' on screen, then make it hex
+ """
+ mode = args[0] if args else "cycle"
+ params = {"mode": mode}
+ if len(args) > 1:
+ params["word"] = args[1]
+ st = c.call("opfmt", **params)
+ return " " + (st.get("opfmt", {}).get("status") or st.get("status", ""))
+
+
def cmd_syms(c, args):
"""syms <file.json> — bulk-apply a symbol file ([{addr|start|ea, name}])."""
if len(args) != 1:
@@ -295,7 +314,7 @@ COMMANDS = {
"callees": cmd_callees, "callers": cmd_callers, "names": cmd_names,
"rename": cmd_rename, "mv": cmd_mv, "note": cmd_note, "retype": cmd_retype,
"save": cmd_save, "screen": cmd_screen, "raw": cmd_raw, "define": cmd_define,
- "syms": cmd_syms,
+ "syms": cmd_syms, "fmt": cmd_fmt,
"binaries": cmd_binaries, "switch": cmd_switch,
}