Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2014-03-31 05:41:38 -0400
committerAnton Leherbauer2014-03-31 05:41:38 -0400
commit0fc90623268a3302a9d06dc497dc10650d1622f0 (patch)
tree65e78006a8ce56c1c2db6177a5848716e940bdca
parent13b45e7bff391883e13f3b675fa891004efe6340 (diff)
downloadorg.eclipse.cdt-0fc90623268a3302a9d06dc497dc10650d1622f0.tar.gz
org.eclipse.cdt-0fc90623268a3302a9d06dc497dc10650d1622f0.tar.xz
org.eclipse.cdt-0fc90623268a3302a9d06dc497dc10650d1622f0.zip
Limit opcode ruler width to max 20 chars
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
index bfcf196172f..923bc1be350 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems and others.
+ * Copyright (c) 2011, 2014 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -26,6 +26,9 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.opcode"; //$NON-NLS-1$
+ /** Maximum width of column (in characters) */
+ private static final int MAXWIDTH= 20;
+
private int fRadix;
private String fRadixPrefix;
@@ -82,6 +85,8 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
for (int i=str.length()+prefixLength; i < nChars; ++i)
buf.append('0');
buf.append(str);
+ if (buf.length() > nChars)
+ buf.delete(nChars, buf.length());
return buf.toString();
}
} else if (pos != null && !pos.fValid) {
@@ -97,7 +102,7 @@ public class OpcodeRulerColumn extends DisassemblyRulerColumn {
@Override
protected int computeNumberOfCharacters() {
DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument();
- return doc.getMaxOpcodeLength(fRadix);
+ return Math.min(MAXWIDTH, doc.getMaxOpcodeLength(fRadix));
}
@Override

Back to the top