count the width of link labels before any html escaping

dbus-notify
Zlatin Balevsky 2022-08-25 16:32:54 +01:00
parent 681e0420cd
commit 87f4eae0c9
No known key found for this signature in database
GPG Key ID: A72832072D525E41
3 changed files with 5 additions and 5 deletions

View File

@ -18,7 +18,7 @@ class CollectionLinkLabel extends MuLinkLabel {
StringBuffer sb = new StringBuffer()
SizeFormatter.format(link.totalSize, sb)
return HTMLSanitizer.escape(link.name) + " (" + link.numFiles + " " + trans("FILES") +
return link.name + " (" + link.numFiles + " " + trans("FILES") +
" " + sb.toString() + trans("BYTES_SHORT") + ")"
}
}

View File

@ -19,6 +19,6 @@ class FileLinkLabel extends MuLinkLabel {
StringBuffer sb = new StringBuffer()
SizeFormatter.format(link.fileSize, sb)
HTMLSanitizer.escape(link.name) + " (" + sb.toString() + trans("BYTES_SHORT") + ")"
link.name + " (" + sb.toString() + trans("BYTES_SHORT") + ")"
}
}

View File

@ -1,6 +1,6 @@
package com.muwire.gui.chat
import com.muwire.gui.HTMLSanitizer
import com.muwire.gui.UISettings
import com.muwire.core.mulinks.MuLink
@ -19,8 +19,8 @@ abstract class MuLinkLabel extends JLabel {
this.settings = settings
String visibleText = getVisibleText()
String nbspd = visibleText.replaceAll(" ", " ")
setText("<html>$nbspd</html>")
String escaped = HTMLSanitizer.escape(visibleText)
setText("<html>$escaped</html>")
int preferredX = 0, preferredY = 24