src/Tools/jEdit/src/jedit/document_view.scala
changeset 40338 e2f03de2b3c7
parent 40154 e11da4ec9d74
child 42825 b04436548927
--- a/src/Tools/jEdit/src/jedit/document_view.scala	Thu Nov 04 10:33:37 2010 +0100
+++ b/src/Tools/jEdit/src/jedit/document_view.scala	Thu Nov 04 10:58:03 2010 +0100
@@ -165,6 +165,8 @@
 
   /* CONTROL-mouse management */
 
+  private var control: Boolean = false
+
   private def exit_control()
   {
     exit_popup()
@@ -184,7 +186,7 @@
 
   private val mouse_motion_listener = new MouseMotionAdapter {
     override def mouseMoved(e: MouseEvent) {
-      val control = if (OperatingSystem.isMacOS()) e.isMetaDown else e.isControlDown
+      control = if (OperatingSystem.isMacOS()) e.isMetaDown else e.isControlDown
       val x = e.getX()
       val y = e.getY()
 
@@ -288,10 +290,20 @@
       Isabelle.swing_buffer_lock(model.buffer) {
         val snapshot = model.snapshot()
         val offset = text_area.xyToOffset(x, y)
-        snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.tooltip) match
-        {
-          case Text.Info(_, Some(text)) #:: _ => Isabelle.tooltip(text)
-          case _ => null
+        if (control) {
+          snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.tooltip) match
+          {
+            case Text.Info(_, Some(text)) #:: _ => Isabelle.tooltip(text)
+            case _ => null
+          }
+        }
+        else {
+          // FIXME snapshot.cumulate
+          snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Markup.popup) match
+          {
+            case Text.Info(_, Some(text)) #:: _ => Isabelle.tooltip(text)
+            case _ => null
+          }
         }
       }
     }