custom ListCellRenderer with text area font ensures that symbols are displayed reliably;
--- a/src/Tools/jEdit/src/isabelle_sidekick.scala Thu Apr 19 21:42:24 2012 +0200
+++ b/src/Tools/jEdit/src/isabelle_sidekick.scala Thu Apr 19 21:47:50 2012 +0200
@@ -13,13 +13,15 @@
import scala.collection.Set
import scala.collection.immutable.TreeSet
+import java.awt.Component
import javax.swing.tree.DefaultMutableTreeNode
import javax.swing.text.Position
-import javax.swing.Icon
+import javax.swing.{Icon, DefaultListCellRenderer, ListCellRenderer, JList}
import org.gjt.sp.jedit.{Buffer, EditPane, TextUtilities, View}
import errorlist.DefaultErrorSource
-import sidekick.{SideKickParser, SideKickParsedData, SideKickCompletion, IAsset}
+import sidekick.{SideKickParser, SideKickParsedData, SideKickCompletion,
+ SideKickCompletionPopup, IAsset}
object Isabelle_Sidekick
@@ -101,8 +103,25 @@
cs.map(Symbol.decode(_)).sorted
else cs).filter(_ != word)
if (ds.isEmpty) null
- else new SideKickCompletion(
- pane.getView, word, ds.toArray.asInstanceOf[Array[Object]]) { }
+ else
+ new SideKickCompletion(pane.getView, word, ds.toArray.asInstanceOf[Array[Object]]) {
+ override def getRenderer() =
+ new ListCellRenderer[Any] {
+ val default_renderer =
+ (new DefaultListCellRenderer).asInstanceOf[ListCellRenderer[Any]]
+
+ override def getListCellRendererComponent(
+ list: JList[_ <: Any], value: Any, index: Int,
+ selected: Boolean, focus: Boolean): Component =
+ {
+ val renderer: Component =
+ default_renderer.getListCellRendererComponent(
+ list, value, index, selected, focus)
+ renderer.setFont(pane.getTextArea.getPainter.getFont)
+ renderer
+ }
+ }
+ }
}
}
}