mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-4297 Fixed screen reader decompiler api to prevent duplicate reading of the line when cursoring up or down a line
This commit is contained in:
parent
dffb5fd859
commit
97fdfddecf
3 changed files with 19 additions and 11 deletions
|
@ -102,13 +102,22 @@ public class ByteViewerComponent extends FieldPanel implements FieldMouseListene
|
|||
ByteBlockInfo info = indexMap.getBlockInfo(fieldLoc.getIndex(), fieldLoc.getFieldNum());
|
||||
if (info != null) {
|
||||
String modelName = model.getName();
|
||||
return modelName + " format at " +
|
||||
info.getBlock().getLocationRepresentation(info.getOffset()) + ", value = " +
|
||||
field.getText();
|
||||
String location = getAccessibleLocationInfo(info.getBlock(), info.getOffset());
|
||||
return modelName + " format at " + location;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getAccessibleLocationInfo(ByteBlock block, BigInteger offset) {
|
||||
if (block instanceof MemoryByteBlock memBlock) {
|
||||
// location represents an address, remove leading zeros to make screen reading concise
|
||||
Address address = memBlock.getAddress(offset);
|
||||
return address.toString(address.getAddressSpace().showSpaceName(), 1);
|
||||
}
|
||||
// otherwise use generic location representation
|
||||
return block.getLocationRepresentation(offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonPressed(FieldLocation fieldLocation, Field field, MouseEvent mouseEvent) {
|
||||
if (fieldLocation == null || field == null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue