Fixed
Status Update
Comments
tn...@google.com <tn...@google.com>
tn...@google.com <tn...@google.com> #2
I tried the following patch locally which seems to fix it; see screenshot:
diff --git android-debuggers/src/com/android/tools/idea/sqlite/ui/mainView/DatabaseInspectorViewImpl.kt android-debuggers/src/com/android/tools/idea/sqlite/ui/mainView/DatabaseInspectorViewImpl.kt
index 19ae2c0f371..22a203b1ee8 100644
--- android-debuggers/src/com/android/tools/idea/sqlite/ui/mainView/DatabaseInspectorViewImpl.kt
+++ android-debuggers/src/com/android/tools/idea/sqlite/ui/mainView/DatabaseInspectorViewImpl.kt
@@ -42,6 +42,7 @@ import com.intellij.ui.tabs.impl.JBEditorTabsBorder
import com.intellij.ui.tabs.impl.JBTabsImpl
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
+import com.intellij.xml.util.XmlStringUtil
import icons.StudioIcons
import java.awt.BorderLayout
import java.awt.GridBagLayout
@@ -167,13 +168,12 @@ class DatabaseInspectorViewImpl(
}
private fun addEmptyStatePanel(text: String) {
- val escapedText = text.replace("&", "&").replace("<", "<").replace(">", ">")
- val editorPane = JEditorPane(
- "text/html",
- "<h2>Database Inspector</h2>" +
- escapedText +
- "<p><a href=\"https://d.android.com/r/studio-ui/db-inspector-help\">Learn more</a></p>"
- )
+ val escapedText = XmlStringUtil.escapeString(text)
+ val editorPane = JEditorPane()
+ editorPane.editorKit = UIUtil.getHTMLEditorKit()
+ editorPane.text = "<h2>Database Inspector</h2>" +
+ escapedText +
+ "<p><a href=\"https://d.android.com/r/studio-ui/db-inspector-help\">Learn more</a></p>"
val document = editorPane.document as HTMLDocument
document.styleSheet.addRule(
"body { text-align: center; font-family: ${UIUtil.getLabelFont()}; font-size: ${UIUtil.getLabelFont().size} pt; }"
The first line, using XmlStringUtil.escapeString, is unrelated but I spotted it when looking at the other code, and it's a useful change to make because the replacement strings in the custom code is wrong (it's missing a trailing ; in each one of those entity strings which is required (and > isn't required to be escaped from text content.)
ps...@google.com <ps...@google.com> #3
Thanks for digging through the code! I've sent out a CL to fix it.
ps...@google.com <ps...@google.com>
tn...@google.com <tn...@google.com> #4
(See
Description
See attached screenshot; when I'm running on Linux a fresh studio-master-dev build and open the database inspector, I see the message -- notice how the fonts on the right are correct (like color for the text foreground) it looks like the wrong colors are used for the empty warning area.