[Bug] Broken disassembler view when using newlines
Operating System
Windows
What's the issue you encountered?
I am building an ImHex plugin and I tried to use newlines for labels in my disassembly. They are not a part of the decoded opcode. I just wanted to resolve jumps into labels with static analysis.
This issue is present on both release and nightly.
On the release version, outcome is almost correct, but it cuts part of the view (it's still scrollable):
After scrolling (the cut part varies in size):
On nightly text renders on another text (both bytes and instructions):
It also moves the rest of the output downwards and it is cut absolutely. No scrolling can help.
The issue doesn't exist for custom, JSON disassemblers.
Maybe it's not an intended solution to my idea. I was thinking about duplicating positions and offsets to make these label equal to instructions. I haven't tried it yet, but I believe it would end up as an undefined behavior.
How can the issue be reproduced?
- https://github.com/Omikorin/chip8
- Put a newline in the format for disassembler's instruction (plugin) or
- For code renderer: use the code below at line 219 in
chip8_disassembler.cpp(just before theelse)
if (m_labels.contains(virtualAddress)) {
inst.bytes = fmt::format("\n{}", inst.bytes);
inst.operators = fmt::format("\n{}", inst.operators);
if (inst.mnemonic.empty()) {
inst.mnemonic = fmt::format(": {}\n", m_labels[virtualAddress]);
} else {
inst.mnemonic = fmt::format(": {}\n{}", m_labels[virtualAddress], inst.mnemonic);
}
}
- For data renderer: use the code below inside the
elseat the end:
if (m_labels.contains(virtualAddress)) {
inst.bytes = fmt::format("\n{}", inst.bytes);
inst.operators = fmt::format("\n{}", opsStr);
inst.mnemonic = fmt::format(": {}\n", m_labels[virtualAddress]);
} else {
inst.mnemonic = "";
inst.operators = opsStr;
}
ImHex Version
1.39.0-53806b3b91fa053460ed96c31161c61c93822319
ImHex Build Type
- Nightly or built from sources
Installation type
Portable
Additional context?
No response
Source: WerWolv/ImHex