src/Tools/jEdit/src/completion_popup.scala
changeset 64621 7116f2634e32
parent 63674 f97f2ad2486a
child 64882 c3b42ac0cf81
equal deleted inserted replaced
64620:14f938969779 64621:7116f2634e32
   118       }
   118       }
   119 
   119 
   120 
   120 
   121     /* rendering */
   121     /* rendering */
   122 
   122 
   123     def rendering(rendering: Rendering, line_range: Text.Range): Option[Text.Info[Color]] =
   123     def rendering(rendering: JEdit_Rendering, line_range: Text.Range): Option[Text.Info[Color]] =
   124     {
   124     {
   125       active_range match {
   125       active_range match {
   126         case Some(range) => range.try_restrict(line_range)
   126         case Some(range) => range.try_restrict(line_range)
   127         case None =>
   127         case None =>
   128           if (line_range.contains(text_area.getCaretPosition)) {
   128           if (line_range.contains(text_area.getCaretPosition)) {
   151     /* syntax completion */
   151     /* syntax completion */
   152 
   152 
   153     def syntax_completion(
   153     def syntax_completion(
   154       history: Completion.History,
   154       history: Completion.History,
   155       explicit: Boolean,
   155       explicit: Boolean,
   156       opt_rendering: Option[Rendering]): Option[Completion.Result] =
   156       opt_rendering: Option[JEdit_Rendering]): Option[Completion.Result] =
   157     {
   157     {
   158       val buffer = text_area.getBuffer
   158       val buffer = text_area.getBuffer
   159       val decode = Isabelle_Encoding.is_active(buffer)
   159       val decode = Isabelle_Encoding.is_active(buffer)
   160 
   160 
   161       Isabelle.buffer_syntax(buffer) match {
   161       Isabelle.buffer_syntax(buffer) match {
   183     }
   183     }
   184 
   184 
   185 
   185 
   186     /* path completion */
   186     /* path completion */
   187 
   187 
   188     def path_completion(rendering: Rendering): Option[Completion.Result] =
   188     def path_completion(rendering: JEdit_Rendering): Option[Completion.Result] =
   189     {
   189     {
   190       def complete(text: String): List[(String, List[String])] =
   190       def complete(text: String): List[(String, List[String])] =
   191       {
   191       {
   192         try {
   192         try {
   193           val path = Path.explode(text)
   193           val path = Path.explode(text)
   748   {
   748   {
   749     val screen = JEdit_Lib.screen_location(layered, location)
   749     val screen = JEdit_Lib.screen_location(layered, location)
   750     val size =
   750     val size =
   751     {
   751     {
   752       val geometry = JEdit_Lib.window_geometry(completion, completion)
   752       val geometry = JEdit_Lib.window_geometry(completion, completion)
   753       val bounds = Rendering.popup_bounds
   753       val bounds = JEdit_Rendering.popup_bounds
   754       val w = geometry.width min (screen.bounds.width * bounds).toInt min layered.getWidth
   754       val w = geometry.width min (screen.bounds.width * bounds).toInt min layered.getWidth
   755       val h = geometry.height min (screen.bounds.height * bounds).toInt min layered.getHeight
   755       val h = geometry.height min (screen.bounds.height * bounds).toInt min layered.getHeight
   756       new Dimension(w, h)
   756       new Dimension(w, h)
   757     }
   757     }
   758     new Popup(layered, completion, screen.relative(layered, size), size)
   758     new Popup(layered, completion, screen.relative(layered, size), size)