From 723fbc9a23a5f2c40230f295cb21a7e70652d17c Mon Sep 17 00:00:00 2001 From: blasty Date: Thu, 6 Aug 2026 15:11:54 +0200 Subject: 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. --- idatui/drive.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'idatui/drive.py') 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 — 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, } -- cgit v1.3.1-sl0p