mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[vcs-log] more precise author column width calculation
Take text style into account during calculation.
This commit is contained in:
@@ -74,6 +74,9 @@ import java.util.Date;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.vcs.log.VcsLogHighlighter.TextStyle.BOLD;
|
||||
import static com.intellij.vcs.log.VcsLogHighlighter.TextStyle.ITALIC;
|
||||
|
||||
public class VcsLogGraphTable extends TableWithProgress implements DataProvider, CopyProvider {
|
||||
private static final Logger LOG = Logger.getInstance(VcsLogGraphTable.class);
|
||||
|
||||
@@ -183,7 +186,15 @@ public class VcsLogGraphTable extends TableWithProgress implements DataProvider,
|
||||
int maxWidth = 0;
|
||||
for (int row = 0; row < maxRowsToCheck; row++) {
|
||||
String value = getModel().getValueAt(row, i).toString();
|
||||
maxWidth = Math.max(getFontMetrics(tableFont.deriveFont(Font.BOLD)).stringWidth(value), maxWidth);
|
||||
Font font = tableFont;
|
||||
VcsLogHighlighter.TextStyle style = getStyle(row, i, value, false, false).getTextStyle();
|
||||
if (BOLD.equals(style)) {
|
||||
font = tableFont.deriveFont(Font.BOLD);
|
||||
}
|
||||
else if (ITALIC.equals(style)) {
|
||||
font = tableFont.deriveFont(Font.ITALIC);
|
||||
}
|
||||
maxWidth = Math.max(getFontMetrics(font).stringWidth(value + "*"), maxWidth);
|
||||
if (!value.isEmpty()) sizeCalculated = true;
|
||||
}
|
||||
int min = Math.min(maxWidth + myStringCellRenderer.getHorizontalTextPadding(), MAX_DEFAULT_AUTHOR_COLUMN_WIDTH);
|
||||
|
||||
Reference in New Issue
Block a user