mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 04:11:44 +08:00
Merge remote-tracking branch 'origin/GP-6263-dragonmacher-copy-text-fix'
into patch (Closes #8797)
This commit is contained in:
+3
-6
@@ -62,9 +62,6 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||||||
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
super(FIELD_NAME, model, hlProvider, displayOptions, fieldOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see ghidra.app.util.viewer.field.FieldFactory#getField(ProxyObj, int)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
public ListingField getField(ProxyObj<?> proxy, int varWidth) {
|
||||||
|
|
||||||
@@ -206,13 +203,13 @@ public class MemoryBlockStartFieldFactory extends FieldFactory {
|
|||||||
String type = "";
|
String type = "";
|
||||||
if (blockType != MemoryBlockType.DEFAULT) {
|
if (blockType != MemoryBlockType.DEFAULT) {
|
||||||
if (block.isMapped()) {
|
if (block.isMapped()) {
|
||||||
type = "(" + block.getSourceInfos().get(0).getDescription() + ")";
|
type = " (" + block.getSourceInfos().get(0).getDescription() + ")";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
type = "(" + blockType + ")";
|
type = " (" + blockType + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String line1 = block.getName() + " " + type;
|
String line1 = block.getName() + type;
|
||||||
String line2 = block.getComment();
|
String line2 = block.getComment();
|
||||||
String line3 = block.getStart().toString(true) + "-" + block.getEnd().toString(true);
|
String line3 = block.getStart().toString(true) + "-" + block.getEnd().toString(true);
|
||||||
Color color = ListingColors.BLOCK_START;
|
Color color = ListingColors.BLOCK_START;
|
||||||
|
|||||||
+18
-7
@@ -513,12 +513,18 @@ public class VerticalLayoutTextField implements TextField {
|
|||||||
return getText().length();
|
return getText().length();
|
||||||
}
|
}
|
||||||
int extraSpace = rowSeparator.length();
|
int extraSpace = rowSeparator.length();
|
||||||
int len = 0;
|
int offset = 0;
|
||||||
for (int i = 0; i < row; i++) {
|
for (int i = 0; i < row; i++) {
|
||||||
len += lines.get(i).length() + extraSpace;
|
String line = lines.get(i);
|
||||||
|
int len = line.length();
|
||||||
|
if (!line.endsWith(rowSeparator)) {
|
||||||
|
len += extraSpace; // getText() performs this same check; be consistent
|
||||||
}
|
}
|
||||||
len += Math.min(col, lines.get(row).length());
|
|
||||||
return len;
|
offset += len;
|
||||||
|
}
|
||||||
|
offset += Math.min(col, lines.get(row).length());
|
||||||
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -527,11 +533,15 @@ public class VerticalLayoutTextField implements TextField {
|
|||||||
int extraSpace = rowSeparator.length();
|
int extraSpace = rowSeparator.length();
|
||||||
int n = subFields.size();
|
int n = subFields.size();
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
int len = lines.get(i).length();
|
String line = lines.get(i);
|
||||||
if (absoluteOffset < len + extraSpace) {
|
int len = line.length();
|
||||||
|
if (!line.endsWith(rowSeparator)) {
|
||||||
|
len += extraSpace; // getText() performs this same check; be consistent
|
||||||
|
}
|
||||||
|
if (absoluteOffset < len) {
|
||||||
return new RowColLocation(i, absoluteOffset);
|
return new RowColLocation(i, absoluteOffset);
|
||||||
}
|
}
|
||||||
absoluteOffset -= len + extraSpace;
|
absoluteOffset -= len;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lastRow = n - 1;
|
int lastRow = n - 1;
|
||||||
@@ -572,6 +582,7 @@ public class VerticalLayoutTextField implements TextField {
|
|||||||
private class FieldRow {
|
private class FieldRow {
|
||||||
private TextField field;
|
private TextField field;
|
||||||
private int dataRow;
|
private int dataRow;
|
||||||
|
@SuppressWarnings("unused") // used by Json
|
||||||
private int screenRow;
|
private int screenRow;
|
||||||
|
|
||||||
FieldRow(TextField field, int dataRow, int screenRow) {
|
FieldRow(TextField field, int dataRow, int screenRow) {
|
||||||
|
|||||||
Reference in New Issue
Block a user