* more general checksum highlighter
This commit is contained in:
parent
66cf786b19
commit
e0d52fb515
|
@ -48,7 +48,7 @@ public final class FileBotUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link Pattern} that will match checksums enclosed in brackets ("[]" or "()"). A
|
* A {@link Pattern} that will match checksums enclosed in brackets ("[]" or "()"). A
|
||||||
* checksum string is a hex number with at least 8 digits. Capturing group 1 will contain
|
* checksum string is a hex number with at least 8 digits. Capturing group 0 will contain
|
||||||
* the matched checksum string.
|
* the matched checksum string.
|
||||||
*/
|
*/
|
||||||
public static final Pattern EMBEDDED_CHECKSUM_PATTERN = Pattern.compile("(?<=\\[|\\()(\\p{XDigit}{8,})(?=\\]|\\))");
|
public static final Pattern EMBEDDED_CHECKSUM_PATTERN = Pattern.compile("(?<=\\[|\\()(\\p{XDigit}{8,})(?=\\]|\\))");
|
||||||
|
@ -60,7 +60,7 @@ public final class FileBotUtil {
|
||||||
|
|
||||||
// get last match
|
// get last match
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
embeddedChecksum = matcher.group(1);
|
embeddedChecksum = matcher.group(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return embeddedChecksum;
|
return embeddedChecksum;
|
||||||
|
|
|
@ -39,7 +39,7 @@ class HighlightPatternCellRenderer extends DefaultTableCellRenderer {
|
||||||
StringBuffer htmlText = new StringBuffer("<html><nobr>");
|
StringBuffer htmlText = new StringBuffer("<html><nobr>");
|
||||||
|
|
||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
matcher.appendReplacement(htmlText, "<span style='font-size: " + cssFontSize + ";" + (!isSelected ? "color: " + cssColor + ";" : "") + "'>$1</span>");
|
matcher.appendReplacement(htmlText, "<span style='font-size: " + cssFontSize + ";" + (!isSelected ? "color: " + cssColor + ";" : "") + "'>$0</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
matcher.appendTail(htmlText);
|
matcher.appendTail(htmlText);
|
||||||
|
|
Loading…
Reference in New Issue