include command results in tooltip as well;
authorwenzelm
Thu, 13 Dec 2012 17:46:33 +0100
changeset 50502 51408dde956f
parent 50501 6f41f1646617
child 50503 50f141b34bb7
include command results in tooltip as well;
src/Tools/jEdit/src/rendering.scala
src/Tools/jEdit/src/rich_text_area.scala
--- a/src/Tools/jEdit/src/rendering.scala	Thu Dec 13 17:29:23 2012 +0100
+++ b/src/Tools/jEdit/src/rendering.scala	Thu Dec 13 17:46:33 2012 +0100
@@ -264,6 +264,14 @@
         }) match { case Text.Info(_, info) #:: _ => Some(info) case _ => None }
 
 
+  def command_results(range: Text.Range): Command.Results =
+  {
+    val results =
+      snapshot.select_markup[Command.Results](range, None, command_state =>
+        { case _ => command_state.results }).map(_.info)
+    (Command.empty_results /: results)(_ ++ _)
+  }
+
   def tooltip_message(range: Text.Range): XML.Body =
   {
     val msgs =
--- a/src/Tools/jEdit/src/rich_text_area.scala	Thu Dec 13 17:29:23 2012 +0100
+++ b/src/Tools/jEdit/src/rich_text_area.scala	Thu Dec 13 17:46:33 2012 +0100
@@ -204,14 +204,14 @@
           JEdit_Lib.pixel_range(text_area, x, y) match {
             case None =>
             case Some(range) =>
-              // FIXME cumulate results!?
               val tip =
                 if (control) rendering.tooltip(range)
                 else rendering.tooltip_message(range)
               if (!tip.isEmpty) {
                 val painter = text_area.getPainter
                 val y1 = y + painter.getFontMetrics.getHeight / 2
-                new Pretty_Tooltip(view, painter, rendering, x, y1, Command.empty_results, tip)
+                val results = rendering.command_results(range)
+                new Pretty_Tooltip(view, painter, rendering, x, y1, results, tip)
               }
           }
         }