src/Tools/jEdit/src/isabelle.scala
changeset 67132 336831647779
parent 67014 e6a695d6a6b2
child 67148 d24dcac5eb4c
equal deleted inserted replaced
67131:85d10959c2e4 67132:336831647779
   418 
   418 
   419   def input_bsup(text_area: JEditTextArea)
   419   def input_bsup(text_area: JEditTextArea)
   420   { enclose_input(text_area, Symbol.bsup_decoded, Symbol.esup_decoded) }
   420   { enclose_input(text_area, Symbol.bsup_decoded, Symbol.esup_decoded) }
   421 
   421 
   422 
   422 
       
   423   /* antiquoted cartouche */
       
   424 
       
   425   def antiquoted_cartouche(text_area: TextArea)
       
   426   {
       
   427     val buffer = text_area.getBuffer
       
   428     for {
       
   429       doc_view <- Document_View.get(text_area)
       
   430       rendering = doc_view.get_rendering()
       
   431       caret_range = JEdit_Lib.caret_range(text_area)
       
   432       antiq_range <- rendering.antiquoted(caret_range)
       
   433       antiq_text <- JEdit_Lib.get_text(buffer, antiq_range)
       
   434       body_text <- Antiquote.read_antiq_body(antiq_text)
       
   435       (name, arg) <- Token.read_antiq_arg(Keyword.Keywords.empty, body_text)
       
   436       if Symbol.is_ascii_identifier(name)
       
   437     } {
       
   438       val op_text =
       
   439         Isabelle_Encoding.perhaps_decode(buffer,
       
   440           Symbol.control_prefix + name + Symbol.control_suffix)
       
   441       val arg_text =
       
   442         if (arg.isEmpty) ""
       
   443         else if (Isabelle_Encoding.is_active(buffer)) Symbol.cartouche_decoded(arg.get)
       
   444         else Symbol.cartouche(arg.get)
       
   445 
       
   446       buffer.remove(antiq_range.start, antiq_range.length)
       
   447       text_area.moveCaretPosition(antiq_range.start)
       
   448       text_area.setSelectedText(op_text + arg_text)
       
   449     }
       
   450   }
       
   451 
       
   452 
   423   /* spell-checker dictionary */
   453   /* spell-checker dictionary */
   424 
   454 
   425   def update_dictionary(text_area: JEditTextArea, include: Boolean, permanent: Boolean)
   455   def update_dictionary(text_area: JEditTextArea, include: Boolean, permanent: Boolean)
   426   {
   456   {
   427     for {
   457     for {