src/Pure/PIDE/editor.scala
author wenzelm
Sat, 01 Nov 2025 14:19:16 +0100
changeset 83437 0556adb3581b
parent 83419 0ac8a8a3793b
permissions -rw-r--r--
clarified modules;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52971
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     1
/*  Title:      Pure/PIDE/editor.scala
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     3
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     4
General editor operations.
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     5
*/
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     6
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     7
package isabelle
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     8
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
     9
82928
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    10
object Editor {
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    11
  /* output messages */
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    12
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    13
  object Output {
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    14
    val none: Output = Output(defined = false)
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    15
    val init: Output = Output()
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    16
  }
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    17
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    18
  sealed case class Output(
83417
b51e4a526897 clarified signature;
wenzelm
parents: 82949
diff changeset
    19
    snapshot: Document.Snapshot = Document.Snapshot.init,
82928
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    20
    results: Command.Results = Command.Results.empty,
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    21
    messages: List[XML.Elem] = Nil,
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    22
    defined: Boolean = true
83419
0ac8a8a3793b clarified signature: prefer explicit type Editor.Output;
wenzelm
parents: 83417
diff changeset
    23
  ) {
0ac8a8a3793b clarified signature: prefer explicit type Editor.Output;
wenzelm
parents: 83417
diff changeset
    24
    def proper: Boolean = messages.nonEmpty && defined
0ac8a8a3793b clarified signature: prefer explicit type Editor.Output;
wenzelm
parents: 83417
diff changeset
    25
  }
82928
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    26
}
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
    27
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 73340
diff changeset
    28
abstract class Editor[Context] {
76794
941d4f527091 clarified modules: avoid duplication;
wenzelm
parents: 76739
diff changeset
    29
  /* PIDE session and document model */
66082
2d12a730a380 clarified modules;
wenzelm
parents: 64867
diff changeset
    30
52971
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
    31
  def session: Session
66084
7f8eeff20f7a tuned signature;
wenzelm
parents: 66082
diff changeset
    32
  def flush(): Unit
54461
6c360a6ade0e centralized management of pending buffer edits;
wenzelm
parents: 53844
diff changeset
    33
  def invoke(): Unit
83437
0556adb3581b clarified modules;
wenzelm
parents: 83419
diff changeset
    34
  def revoke(): Unit
66101
0f0f294e314f maintain overlays within main state of document models;
wenzelm
parents: 66094
diff changeset
    35
76794
941d4f527091 clarified modules: avoid duplication;
wenzelm
parents: 76739
diff changeset
    36
  def get_models(): Iterable[Document.Model]
941d4f527091 clarified modules: avoid duplication;
wenzelm
parents: 76739
diff changeset
    37
941d4f527091 clarified modules: avoid duplication;
wenzelm
parents: 76739
diff changeset
    38
76609
cc9ddf373bd2 maintain global state of document editor views, notably for is_active operation;
wenzelm
parents: 75393
diff changeset
    39
  /* document editor */
cc9ddf373bd2 maintain global state of document editor views, notably for is_active operation;
wenzelm
parents: 75393
diff changeset
    40
cc9ddf373bd2 maintain global state of document editor views, notably for is_active operation;
wenzelm
parents: 75393
diff changeset
    41
  protected val document_editor: Synchronized[Document_Editor.State] =
cc9ddf373bd2 maintain global state of document editor views, notably for is_active operation;
wenzelm
parents: 75393
diff changeset
    42
    Synchronized(Document_Editor.State())
cc9ddf373bd2 maintain global state of document editor views, notably for is_active operation;
wenzelm
parents: 75393
diff changeset
    43
76715
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    44
  protected def document_state(): Document_Editor.State = document_editor.value
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    45
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    46
  protected def document_state_changed(): Unit = {}
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    47
  private def document_state_change(f: Document_Editor.State => Document_Editor.State): Unit = {
76705
ddf5764684dd proper state change, e.g. on open/close of "Document" panel;
wenzelm
parents: 76701
diff changeset
    48
    val changed =
ddf5764684dd proper state change, e.g. on open/close of "Document" panel;
wenzelm
parents: 76701
diff changeset
    49
      document_editor.change_result { st =>
ddf5764684dd proper state change, e.g. on open/close of "Document" panel;
wenzelm
parents: 76701
diff changeset
    50
        val st1 = f(st)
76725
c8d5cc19270a more thorough GUI updates, notably for multiple Document dockables;
wenzelm
parents: 76720
diff changeset
    51
        val changed =
c8d5cc19270a more thorough GUI updates, notably for multiple Document dockables;
wenzelm
parents: 76720
diff changeset
    52
          st.active_document_theories != st1.active_document_theories ||
76739
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    53
          st.selection != st1.selection
76725
c8d5cc19270a more thorough GUI updates, notably for multiple Document dockables;
wenzelm
parents: 76720
diff changeset
    54
        (changed, st1)
76705
ddf5764684dd proper state change, e.g. on open/close of "Document" panel;
wenzelm
parents: 76701
diff changeset
    55
      }
76715
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    56
    if (changed) document_state_changed()
76705
ddf5764684dd proper state change, e.g. on open/close of "Document" panel;
wenzelm
parents: 76701
diff changeset
    57
  }
76715
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    58
77144
42c3970e1ac1 clarified Document_Editor.Session: more explicit types, more robust operations;
wenzelm
parents: 77142
diff changeset
    59
  def document_session(): Document_Editor.Session =
77161
913c781ff6ba support document preparation from already loaded theories;
wenzelm
parents: 77144
diff changeset
    60
    document_state().session(session)
76715
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    61
76739
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    62
  def document_required(): List[Document.Node.Name] = {
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    63
    val st = document_state()
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    64
    if (st.is_active) {
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    65
      for {
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    66
        a <- st.all_document_theories
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    67
        b = session.resources.migrate_name(a)
77197
a541da01ba67 clarified signature selection: SortedSet[String], which fits better to stored json and works properly on Windows (NB: document theories have an authentic session-theory name);
wenzelm
parents: 77161
diff changeset
    68
        if st.selection(b.theory)
76739
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    69
      } yield b
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    70
    }
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    71
    else Nil
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    72
  }
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    73
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    74
  def document_node_required(name: Document.Node.Name): Boolean = {
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    75
    val st = document_state()
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    76
    st.is_active &&
77197
a541da01ba67 clarified signature selection: SortedSet[String], which fits better to stored json and works properly on Windows (NB: document theories have an authentic session-theory name);
wenzelm
parents: 77161
diff changeset
    77
    st.selection.contains(name.theory) &&
a541da01ba67 clarified signature selection: SortedSet[String], which fits better to stored json and works properly on Windows (NB: document theories have an authentic session-theory name);
wenzelm
parents: 77161
diff changeset
    78
    st.all_document_theories.exists(a => a.theory == name.theory)
76739
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    79
  }
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    80
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    81
  def document_theories(): List[Document.Node.Name] =
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    82
    document_state().active_document_theories.map(session.resources.migrate_name)
cb72b5996520 proper migrate_name between different kinds of Resources, notably for Windows;
wenzelm
parents: 76732
diff changeset
    83
77197
a541da01ba67 clarified signature selection: SortedSet[String], which fits better to stored json and works properly on Windows (NB: document theories have an authentic session-theory name);
wenzelm
parents: 77161
diff changeset
    84
  def document_selection(): Set[String] = document_state().selection
76716
a7602257a825 clarified state document nodes for Theories_Status / Document_Dockable;
wenzelm
parents: 76715
diff changeset
    85
76701
3543ecb4c97d tuned signature;
wenzelm
parents: 76678
diff changeset
    86
  def document_setup(background: Option[Sessions.Background]): Unit =
76715
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    87
    document_state_change(_.copy(session_background = background))
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    88
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    89
  def document_select(
77197
a541da01ba67 clarified signature selection: SortedSet[String], which fits better to stored json and works properly on Windows (NB: document theories have an authentic session-theory name);
wenzelm
parents: 77161
diff changeset
    90
    theories: Iterable[String],
76715
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    91
    set: Boolean = false,
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    92
    toggle: Boolean = false
77197
a541da01ba67 clarified signature selection: SortedSet[String], which fits better to stored json and works properly on Windows (NB: document theories have an authentic session-theory name);
wenzelm
parents: 77161
diff changeset
    93
  ): Unit = document_state_change(_.select(theories, set = set, toggle = toggle))
76715
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    94
76720
37f7b2965e02 more GUI operations;
wenzelm
parents: 76716
diff changeset
    95
  def document_select_all(set: Boolean = false): Unit =
77197
a541da01ba67 clarified signature selection: SortedSet[String], which fits better to stored json and works properly on Windows (NB: document theories have an authentic session-theory name);
wenzelm
parents: 77161
diff changeset
    96
    document_state_change(st =>
a541da01ba67 clarified signature selection: SortedSet[String], which fits better to stored json and works properly on Windows (NB: document theories have an authentic session-theory name);
wenzelm
parents: 77161
diff changeset
    97
      st.select(st.active_document_theories.map(_.theory), set = set))
76720
37f7b2965e02 more GUI operations;
wenzelm
parents: 76716
diff changeset
    98
76715
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
    99
  def document_init(id: AnyRef): Unit = document_state_change(_.register_view(id))
bf5ff407f32f clarified state of document model vs. document editor selection (again, see also a9d52d02bd83);
wenzelm
parents: 76705
diff changeset
   100
  def document_exit(id: AnyRef): Unit = document_state_change(_.unregister_view(id))
76609
cc9ddf373bd2 maintain global state of document editor views, notably for is_active operation;
wenzelm
parents: 75393
diff changeset
   101
cc9ddf373bd2 maintain global state of document editor views, notably for is_active operation;
wenzelm
parents: 75393
diff changeset
   102
66101
0f0f294e314f maintain overlays within main state of document models;
wenzelm
parents: 66094
diff changeset
   103
  /* current situation */
0f0f294e314f maintain overlays within main state of document models;
wenzelm
parents: 66094
diff changeset
   104
52971
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
   105
  def current_node(context: Context): Option[Document.Node.Name]
52978
37fbb3fde380 prefer PIDE editor operations;
wenzelm
parents: 52977
diff changeset
   106
  def current_node_snapshot(context: Context): Option[Document.Snapshot]
52974
908e8a36e975 tuned signature;
wenzelm
parents: 52971
diff changeset
   107
  def node_snapshot(name: Document.Node.Name): Document.Snapshot
53844
71f103629327 skip ignored commands, similar to former proper_command_at (see d68ea01d5084) -- relevant to Output, Query_Operation etc.;
wenzelm
parents: 52980
diff changeset
   108
  def current_command(context: Context, snapshot: Document.Snapshot): Option[Command]
52977
15254e32d299 central management of Document.Overlays, independent of Document_Model;
wenzelm
parents: 52974
diff changeset
   109
66082
2d12a730a380 clarified modules;
wenzelm
parents: 64867
diff changeset
   110
82925
f4d263dc4442 clarified signature: more explicit operations;
wenzelm
parents: 77197
diff changeset
   111
  /* output messages */
f4d263dc4442 clarified signature: more explicit operations;
wenzelm
parents: 77197
diff changeset
   112
f4d263dc4442 clarified signature: more explicit operations;
wenzelm
parents: 77197
diff changeset
   113
  def output_state(): Boolean
f4d263dc4442 clarified signature: more explicit operations;
wenzelm
parents: 77197
diff changeset
   114
82928
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   115
  def output(
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   116
    snapshot: Document.Snapshot,
82946
962b73cc57dc clarified signature: more self-contained operation;
wenzelm
parents: 82945
diff changeset
   117
    caret_offset: Text.Offset,
82928
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   118
    restriction: Option[Set[Command]] = None
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   119
  ): Editor.Output = {
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   120
    if (snapshot.is_outdated) Editor.Output.none
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   121
    else {
82946
962b73cc57dc clarified signature: more self-contained operation;
wenzelm
parents: 82945
diff changeset
   122
      val thy_command_range = snapshot.loaded_theory_command(caret_offset)
962b73cc57dc clarified signature: more self-contained operation;
wenzelm
parents: 82945
diff changeset
   123
      val thy_command = thy_command_range.map(_._1)
82935
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   124
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   125
      def filter(msg: XML.Elem): Boolean =
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   126
        (for {
82946
962b73cc57dc clarified signature: more self-contained operation;
wenzelm
parents: 82945
diff changeset
   127
          (command, command_range) <- thy_command_range
82949
728762181377 minor performance tuning;
wenzelm
parents: 82946
diff changeset
   128
          msg_offset <- Position.Offset.unapply(msg.markup.properties)
728762181377 minor performance tuning;
wenzelm
parents: 82946
diff changeset
   129
        } yield command_range.contains(command.chunk.decode(msg_offset))) getOrElse true
82935
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   130
82946
962b73cc57dc clarified signature: more self-contained operation;
wenzelm
parents: 82945
diff changeset
   131
      thy_command orElse snapshot.current_command(snapshot.node_name, caret_offset) match {
82928
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   132
        case None => Editor.Output.init
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   133
        case Some(command) =>
82935
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   134
          if (thy_command.isDefined || restriction.isEmpty || restriction.get.contains(command)) {
82928
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   135
            val results = snapshot.command_results(command)
82930
wenzelm
parents: 82928
diff changeset
   136
            val messages = {
82935
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   137
              val (states, other) = {
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   138
                List.from(
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   139
                  for ((_, msg) <- results.iterator if !Protocol.is_result(msg) && filter(msg))
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   140
                    yield msg).partition(Protocol.is_state)
2b7080493211 more accurate output, based on persistent "command_range" markup;
wenzelm
parents: 82930
diff changeset
   141
              }
82930
wenzelm
parents: 82928
diff changeset
   142
              val (urgent, regular) = other.partition(Protocol.is_urgent)
wenzelm
parents: 82928
diff changeset
   143
              urgent ::: (if (output_state()) states else Nil) ::: regular
wenzelm
parents: 82928
diff changeset
   144
            }
83417
b51e4a526897 clarified signature;
wenzelm
parents: 82949
diff changeset
   145
            Editor.Output(snapshot = snapshot, results = results, messages = messages)
82928
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   146
          }
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   147
          else Editor.Output.none
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   148
      }
90e4e9091531 clarified Editor.Output: more uniform handling in Isabelle/jEdit and Isabelle/VSCode;
wenzelm
parents: 82926
diff changeset
   149
    }
82926
f4bc5313c821 clarified modules;
wenzelm
parents: 82925
diff changeset
   150
  }
f4bc5313c821 clarified modules;
wenzelm
parents: 82925
diff changeset
   151
82925
f4d263dc4442 clarified signature: more explicit operations;
wenzelm
parents: 77197
diff changeset
   152
66082
2d12a730a380 clarified modules;
wenzelm
parents: 64867
diff changeset
   153
  /* overlays */
2d12a730a380 clarified modules;
wenzelm
parents: 64867
diff changeset
   154
66101
0f0f294e314f maintain overlays within main state of document models;
wenzelm
parents: 66094
diff changeset
   155
  def node_overlays(name: Document.Node.Name): Document.Node.Overlays
73340
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 66101
diff changeset
   156
  def insert_overlay(command: Command, fn: String, args: List[String]): Unit
0ffcad1f6130 tuned --- fewer warnings;
wenzelm
parents: 66101
diff changeset
   157
  def remove_overlay(command: Command, fn: String, args: List[String]): Unit
66082
2d12a730a380 clarified modules;
wenzelm
parents: 64867
diff changeset
   158
2d12a730a380 clarified modules;
wenzelm
parents: 64867
diff changeset
   159
2d12a730a380 clarified modules;
wenzelm
parents: 64867
diff changeset
   160
  /* hyperlinks */
52980
28f59ca8ce78 manage hyperlinks via PIDE editor interface;
wenzelm
parents: 52978
diff changeset
   161
75393
87ebf5a50283 clarified formatting, for the sake of scala3;
wenzelm
parents: 73340
diff changeset
   162
  abstract class Hyperlink {
64663
wenzelm
parents: 64524
diff changeset
   163
    def external: Boolean = false
56494
1b74abf064e1 avoid confusion about pointless cursor movement with external links;
wenzelm
parents: 55884
diff changeset
   164
    def follow(context: Context): Unit
1b74abf064e1 avoid confusion about pointless cursor movement with external links;
wenzelm
parents: 55884
diff changeset
   165
  }
66084
7f8eeff20f7a tuned signature;
wenzelm
parents: 66082
diff changeset
   166
52980
28f59ca8ce78 manage hyperlinks via PIDE editor interface;
wenzelm
parents: 52978
diff changeset
   167
  def hyperlink_command(
64664
wenzelm
parents: 64663
diff changeset
   168
    focus: Boolean, snapshot: Document.Snapshot, id: Document_ID.Generic, offset: Symbol.Offset = 0)
60893
3c8b9b4b577c support hyperlinks with optional focus change;
wenzelm
parents: 56494
diff changeset
   169
      : Option[Hyperlink]
66094
24658c9d7c78 more general dispatcher operations;
wenzelm
parents: 66084
diff changeset
   170
24658c9d7c78 more general dispatcher operations;
wenzelm
parents: 66084
diff changeset
   171
24658c9d7c78 more general dispatcher operations;
wenzelm
parents: 66084
diff changeset
   172
  /* dispatcher thread */
24658c9d7c78 more general dispatcher operations;
wenzelm
parents: 66084
diff changeset
   173
24658c9d7c78 more general dispatcher operations;
wenzelm
parents: 66084
diff changeset
   174
  def assert_dispatcher[A](body: => A): A
24658c9d7c78 more general dispatcher operations;
wenzelm
parents: 66084
diff changeset
   175
  def require_dispatcher[A](body: => A): A
24658c9d7c78 more general dispatcher operations;
wenzelm
parents: 66084
diff changeset
   176
  def send_dispatcher(body: => Unit): Unit
24658c9d7c78 more general dispatcher operations;
wenzelm
parents: 66084
diff changeset
   177
  def send_wait_dispatcher(body: => Unit): Unit
52971
31926d2c04ee tuned signature -- more abstract PIDE editor operations;
wenzelm
parents:
diff changeset
   178
}