Cutter: Add a hotkey for toggling immidiate base

Created on 4 Sep 2020  路  2Comments  路  Source: rizinorg/cutter

Is your feature request related to a problem? Please describe.

It'll be nice to have a hotkey (like H in IDA) to toggle the integer base between HEX and DEC. Since it may not work in Decompiler without backend support, having it in Disassembly/Graph will still be nice.

Describe the solution you'd like

So when I press the hotkey (maybe H if it's available), it should work like this:
toggle_base

Describe alternatives you've considered

Click on integer -> Set Immidiate base to -> Hex/Dec

Additional context

Enhancement HacktoberFest good first issue

Most helpful comment

@plaets it's totally fine to discuss it here but since you have POC ready and nobody else is working on it, I'll suggest you draft a PR and keep working on it. That way you'll be able to get feedback early on.
That said, thanks for your interest and I'd like to see it in Graph view as well :)

All 2 comments

Hello, I've been working on this issue at https://github.com/plaets/cutter/tree/issue-2420
I've already developed a (proof of concept) implementation of this, but currently, the user needs to press the hotkey twice to switch from decimal to hexadecimal base (but only if the value is decimal by default, after the first switch the hotkey works as I expect it to). That is because I'm using ahj to get the current immediate base, and it looks like this command specifies it only if it was changed before. If there is no immbase in ahj output I just assume that the value is hexadecimal, but this is not always true.
The hotkey does not work for graphs in the latest commit, but it should be easy to implement there too.
I wasn't able to find any other way to get the current immediate base. Maybe there is a way to figure it out from aoj but I don't know how. I'm not sure how to proceed...

(I apologize if issues are not the best place to discuss my own implementation, maybe I should open a pull request instead)

@plaets it's totally fine to discuss it here but since you have POC ready and nobody else is working on it, I'll suggest you draft a PR and keep working on it. That way you'll be able to get feedback early on.
That said, thanks for your interest and I'd like to see it in Graph view as well :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Maijin picture Maijin  路  4Comments

0x913 picture 0x913  路  3Comments

hamsterwoede picture hamsterwoede  路  4Comments

dhucul picture dhucul  路  3Comments

Maijin picture Maijin  路  5Comments