mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +02:00
Limit opcode ruler width to max 20 chars
This commit is contained in:
parent
4d2a57889c
commit
7d147536f3
1 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue