src/Tools/jEdit/src/isabelle_encoding.scala
author wenzelm
Sun Aug 20 14:03:23 2017 +0200 (20 months ago)
changeset 66457 9098c36abd1a
parent 62527 aae9a2a855e0
child 67130 b023f64e0d16
permissions -rw-r--r--
separate base plugin for important services that should be always available, despite startup errors of the main plugin;
     1 /*  Title:      Tools/jEdit/src/isabelle_encoding.scala
     2     Author:     Makarius
     3 
     4 Isabelle encoding -- based on UTF-8.
     5 */
     6 
     7 package isabelle.jedit
     8 
     9 
    10 import isabelle._
    11 
    12 import org.gjt.sp.jedit.buffer.JEditBuffer
    13 
    14 
    15 object Isabelle_Encoding
    16 {
    17   def is_active(buffer: JEditBuffer): Boolean =
    18     buffer.getStringProperty(JEditBuffer.ENCODING).asInstanceOf[String] == "UTF-8-Isabelle"
    19 
    20   def maybe_decode(buffer: JEditBuffer, s: String): String =
    21     if (is_active(buffer)) Symbol.decode(s) else s
    22 }