src/Tools/jEdit/src/document_view.scala
author wenzelm
Sat Apr 07 17:49:20 2012 +0200 (2012-04-07)
changeset 47392 6a08fd7a6071
parent 47027 fc3bb6c02a3c
child 47993 135fd6f2dadd
permissions -rw-r--r--
tuned imports;
wenzelm@43282
     1
/*  Title:      Tools/jEdit/src/document_view.scala
wenzelm@36760
     2
    Author:     Fabian Immler, TU Munich
wenzelm@36760
     3
    Author:     Makarius
wenzelm@36760
     4
wenzelm@36760
     5
Document view connected to jEdit text area.
wenzelm@36760
     6
*/
wenzelm@34408
     7
immler@34403
     8
package isabelle.jedit
immler@34403
     9
wenzelm@34760
    10
wenzelm@36015
    11
import isabelle._
wenzelm@36015
    12
wenzelm@44379
    13
import scala.collection.mutable
wenzelm@45460
    14
import scala.collection.immutable.SortedMap
wenzelm@34784
    15
import scala.actors.Actor._
wenzelm@34784
    16
wenzelm@43520
    17
import java.lang.System
wenzelm@45744
    18
import java.text.BreakIterator
wenzelm@46572
    19
import java.awt.{Color, Graphics2D, Point}
wenzelm@46572
    20
import java.awt.event.{MouseMotionAdapter, MouseEvent,
wenzelm@39741
    21
  FocusAdapter, FocusEvent, WindowEvent, WindowAdapter}
wenzelm@46572
    22
import javax.swing.{Popup, PopupFactory, SwingUtilities, BorderFactory}
wenzelm@34784
    23
import javax.swing.event.{CaretListener, CaretEvent}
wenzelm@34734
    24
wenzelm@43404
    25
import org.gjt.sp.util.Log
wenzelm@43404
    26
wenzelm@42839
    27
import org.gjt.sp.jedit.{jEdit, OperatingSystem, Debug}
wenzelm@34709
    28
import org.gjt.sp.jedit.gui.RolloverButton
wenzelm@39176
    29
import org.gjt.sp.jedit.options.GutterOptionPane
wenzelm@47392
    30
import org.gjt.sp.jedit.textarea.{JEditTextArea, TextArea, TextAreaExtension, TextAreaPainter}
wenzelm@43369
    31
import org.gjt.sp.jedit.syntax.{SyntaxStyle}
wenzelm@34784
    32
wenzelm@34784
    33
wenzelm@34784
    34
object Document_View
wenzelm@34784
    35
{
wenzelm@34784
    36
  /* document view of text area */
wenzelm@34784
    37
wenzelm@34784
    38
  private val key = new Object
wenzelm@34784
    39
wenzelm@39741
    40
  def apply(text_area: JEditTextArea): Option[Document_View] =
wenzelm@34784
    41
  {
wenzelm@38223
    42
    Swing_Thread.require()
wenzelm@34784
    43
    text_area.getClientProperty(key) match {
wenzelm@34784
    44
      case doc_view: Document_View => Some(doc_view)
wenzelm@34784
    45
      case _ => None
wenzelm@34784
    46
    }
wenzelm@34784
    47
  }
wenzelm@34784
    48
wenzelm@39741
    49
  def exit(text_area: JEditTextArea)
wenzelm@34784
    50
  {
wenzelm@38223
    51
    Swing_Thread.require()
wenzelm@34788
    52
    apply(text_area) match {
wenzelm@39636
    53
      case None =>
wenzelm@34784
    54
      case Some(doc_view) =>
wenzelm@34784
    55
        doc_view.deactivate()
wenzelm@34784
    56
        text_area.putClientProperty(key, null)
wenzelm@34784
    57
    }
wenzelm@34784
    58
  }
wenzelm@43397
    59
wenzelm@43397
    60
  def init(model: Document_Model, text_area: JEditTextArea): Document_View =
wenzelm@43397
    61
  {
wenzelm@43397
    62
    exit(text_area)
wenzelm@43397
    63
    val doc_view = new Document_View(model, text_area)
wenzelm@43397
    64
    text_area.putClientProperty(key, doc_view)
wenzelm@43397
    65
    doc_view.activate()
wenzelm@43397
    66
    doc_view
wenzelm@43397
    67
  }
wenzelm@34784
    68
}
immler@34403
    69
wenzelm@34733
    70
wenzelm@43376
    71
class Document_View(val model: Document_Model, val text_area: JEditTextArea)
immler@34654
    72
{
wenzelm@34784
    73
  private val session = model.session
wenzelm@34784
    74
immler@34403
    75
wenzelm@43419
    76
  /* robust extension body */
wenzelm@43404
    77
wenzelm@43404
    78
  def robust_body[A](default: A)(body: => A): A =
wenzelm@43417
    79
  {
wenzelm@43417
    80
    try {
wenzelm@43417
    81
      Swing_Thread.require()
wenzelm@43417
    82
      if (model.buffer == text_area.getBuffer) body
wenzelm@43417
    83
      else {
wenzelm@43650
    84
        Log.log(Log.ERROR, this, ERROR("Inconsistent document model"))
wenzelm@43417
    85
        default
wenzelm@43404
    86
      }
wenzelm@43404
    87
    }
wenzelm@43417
    88
    catch { case t: Throwable => Log.log(Log.ERROR, this, t); default }
wenzelm@43417
    89
  }
wenzelm@43404
    90
wenzelm@43404
    91
wenzelm@44378
    92
  /* visible text range */
wenzelm@38881
    93
wenzelm@46815
    94
  // NB: TextArea.getScreenLineEndOffset of last line is beyond Buffer.getLength
wenzelm@38881
    95
  def proper_line_range(start: Text.Offset, end: Text.Offset): Text.Range =
wenzelm@46812
    96
    Text.Range(start, end min model.buffer.getLength)
wenzelm@38881
    97
wenzelm@46583
    98
  def visible_range(): Option[Text.Range] =
wenzelm@38881
    99
  {
wenzelm@46583
   100
    val n = text_area.getVisibleLines
wenzelm@46583
   101
    if (n > 0) {
wenzelm@46583
   102
      val start = text_area.getScreenLineStartOffset(0)
wenzelm@46583
   103
      val raw_end = text_area.getScreenLineEndOffset(n - 1)
wenzelm@46583
   104
      Some(proper_line_range(start, if (raw_end >= 0) raw_end else model.buffer.getLength))
wenzelm@46583
   105
    }
wenzelm@46583
   106
    else None
wenzelm@38881
   107
  }
wenzelm@38881
   108
wenzelm@44378
   109
  def invalidate_range(range: Text.Range)
wenzelm@39132
   110
  {
wenzelm@39132
   111
    text_area.invalidateLineRange(
wenzelm@39132
   112
      model.buffer.getLineOfOffset(range.start),
wenzelm@39132
   113
      model.buffer.getLineOfOffset(range.stop))
wenzelm@39132
   114
  }
wenzelm@39132
   115
wenzelm@38881
   116
wenzelm@44379
   117
  /* perspective */
wenzelm@44379
   118
wenzelm@44379
   119
  def perspective(): Text.Perspective =
wenzelm@44379
   120
  {
wenzelm@44379
   121
    Swing_Thread.require()
wenzelm@44776
   122
    val buffer_range = model.buffer_range()
wenzelm@44473
   123
    Text.Perspective(
wenzelm@44379
   124
      for {
wenzelm@44379
   125
        i <- 0 until text_area.getVisibleLines
wenzelm@46997
   126
        start = text_area.getScreenLineStartOffset(i)
wenzelm@46997
   127
        stop = text_area.getScreenLineEndOffset(i)
wenzelm@44379
   128
        if start >= 0 && stop >= 0
wenzelm@46997
   129
        range <- buffer_range.try_restrict(Text.Range(start, stop))
wenzelm@44583
   130
        if !range.is_singularity
wenzelm@44379
   131
      }
wenzelm@44583
   132
      yield range)
wenzelm@44379
   133
  }
wenzelm@44379
   134
wenzelm@44437
   135
  private def update_perspective = new TextAreaExtension
wenzelm@44437
   136
  {
wenzelm@44437
   137
    override def paintScreenLineRange(gfx: Graphics2D,
wenzelm@44437
   138
      first_line: Int, last_line: Int, physical_lines: Array[Int],
wenzelm@44437
   139
      start: Array[Int], end: Array[Int], y: Int, line_height: Int)
wenzelm@44437
   140
    {
wenzelm@44437
   141
      model.update_perspective()
wenzelm@44437
   142
    }
wenzelm@44437
   143
  }
wenzelm@44437
   144
wenzelm@44379
   145
wenzelm@39740
   146
  /* HTML popups */
wenzelm@39740
   147
wenzelm@39740
   148
  private var html_popup: Option[Popup] = None
wenzelm@34834
   149
wenzelm@39740
   150
  private def exit_popup() { html_popup.map(_.hide) }
wenzelm@38881
   151
wenzelm@39740
   152
  private val html_panel =
wenzelm@43661
   153
    new HTML_Panel(Isabelle.font_family(), scala.math.round(Isabelle.font_size()))
wenzelm@39741
   154
  html_panel.setBorder(BorderFactory.createLineBorder(Color.black))
wenzelm@38884
   155
wenzelm@39740
   156
  private def html_panel_resize()
wenzelm@39740
   157
  {
wenzelm@39740
   158
    Swing_Thread.now {
wenzelm@39740
   159
      html_panel.resize(Isabelle.font_family(), scala.math.round(Isabelle.font_size()))
wenzelm@39740
   160
    }
wenzelm@39740
   161
  }
wenzelm@38884
   162
wenzelm@39740
   163
  private def init_popup(snapshot: Document.Snapshot, x: Int, y: Int)
wenzelm@39740
   164
  {
wenzelm@39740
   165
    exit_popup()
wenzelm@40154
   166
/* FIXME broken
wenzelm@39740
   167
    val offset = text_area.xyToOffset(x, y)
wenzelm@39740
   168
    val p = new Point(x, y); SwingUtilities.convertPointToScreen(p, text_area.getPainter)
wenzelm@34784
   169
wenzelm@39740
   170
    // FIXME snapshot.cumulate
wenzelm@45665
   171
    snapshot.select_markup(Text.Range(offset, offset + 1))(Isabelle_Rendering.popup) match {
wenzelm@39740
   172
      case Text.Info(_, Some(msg)) #:: _ =>
wenzelm@39740
   173
        val popup = PopupFactory.getSharedInstance().getPopup(text_area, html_panel, p.x, p.y + 60)
wenzelm@39740
   174
        html_panel.render_sync(List(msg))
wenzelm@39742
   175
        Thread.sleep(10)  // FIXME !?
wenzelm@39740
   176
        popup.show
wenzelm@39740
   177
        html_popup = Some(popup)
wenzelm@39740
   178
      case _ =>
immler@34403
   179
    }
wenzelm@40154
   180
*/
immler@34678
   181
  }
immler@34403
   182
immler@34403
   183
wenzelm@39131
   184
  /* subexpression highlighting */
wenzelm@39131
   185
wenzelm@46205
   186
  @volatile private var _highlight_range: Option[Text.Info[Color]] = None
wenzelm@46205
   187
  def highlight_range(): Option[Text.Info[Color]] = _highlight_range
wenzelm@39740
   188
wenzelm@40338
   189
  private var control: Boolean = false
wenzelm@40338
   190
wenzelm@39740
   191
  private def exit_control()
wenzelm@39740
   192
  {
wenzelm@39740
   193
    exit_popup()
wenzelm@43381
   194
    _highlight_range = None
wenzelm@39740
   195
  }
wenzelm@39740
   196
wenzelm@39131
   197
  private val focus_listener = new FocusAdapter {
wenzelm@39742
   198
    override def focusLost(e: FocusEvent) {
wenzelm@43381
   199
      _highlight_range = None // FIXME exit_control !?
wenzelm@39742
   200
    }
wenzelm@39131
   201
  }
wenzelm@39131
   202
wenzelm@39741
   203
  private val window_listener = new WindowAdapter {
wenzelm@39741
   204
    override def windowIconified(e: WindowEvent) { exit_control() }
wenzelm@39742
   205
    override def windowDeactivated(e: WindowEvent) { exit_control() }
wenzelm@39741
   206
  }
wenzelm@39741
   207
wenzelm@39131
   208
  private val mouse_motion_listener = new MouseMotionAdapter {
wenzelm@39131
   209
    override def mouseMoved(e: MouseEvent) {
wenzelm@46920
   210
      Swing_Thread.assert()
wenzelm@46920
   211
wenzelm@40338
   212
      control = if (OperatingSystem.isMacOS()) e.isMetaDown else e.isControlDown
wenzelm@39740
   213
      val x = e.getX()
wenzelm@39740
   214
      val y = e.getY()
wenzelm@39740
   215
wenzelm@39740
   216
      if (!model.buffer.isLoaded) exit_control()
wenzelm@39132
   217
      else
wenzelm@46920
   218
        Isabelle.buffer_lock(model.buffer) {
wenzelm@47027
   219
          val snapshot = model.snapshot()
wenzelm@39740
   220
wenzelm@39740
   221
          if (control) init_popup(snapshot, x, y)
wenzelm@39740
   222
wenzelm@46205
   223
          for (Text.Info(range, _) <- _highlight_range) invalidate_range(range)
wenzelm@46205
   224
          _highlight_range =
wenzelm@46205
   225
            if (control) {
wenzelm@46205
   226
              val offset = text_area.xyToOffset(x, y)
wenzelm@46205
   227
              Isabelle_Rendering.subexp(snapshot, Text.Range(offset, offset + 1))
wenzelm@46205
   228
            }
wenzelm@46205
   229
            else None
wenzelm@46205
   230
          for (Text.Info(range, _) <- _highlight_range) invalidate_range(range)
wenzelm@39132
   231
        }
wenzelm@39131
   232
    }
wenzelm@39131
   233
  }
wenzelm@39131
   234
wenzelm@39131
   235
wenzelm@43381
   236
  /* text area painting */
wenzelm@39044
   237
wenzelm@43381
   238
  private val text_area_painter = new Text_Area_Painter(this)
wenzelm@39700
   239
wenzelm@43381
   240
  private val tooltip_painter = new TextAreaExtension
wenzelm@43381
   241
  {
wenzelm@34784
   242
    override def getToolTipText(x: Int, y: Int): String =
wenzelm@34784
   243
    {
wenzelm@43404
   244
      robust_body(null: String) {
wenzelm@47027
   245
        val snapshot = model.snapshot()
wenzelm@38845
   246
        val offset = text_area.xyToOffset(x, y)
wenzelm@45460
   247
        val range = Text.Range(offset, offset + 1)
wenzelm@46178
   248
        val tip =
wenzelm@46178
   249
          if (control) Isabelle_Rendering.tooltip(snapshot, range)
wenzelm@46178
   250
          else Isabelle_Rendering.tooltip_message(snapshot, range)
wenzelm@46178
   251
        tip.map(Isabelle.tooltip(_)) getOrElse null
wenzelm@34784
   252
      }
wenzelm@34734
   253
    }
immler@34678
   254
  }
immler@34513
   255
wenzelm@42825
   256
  private val gutter_painter = new TextAreaExtension
wenzelm@39175
   257
  {
wenzelm@39175
   258
    override def paintScreenLineRange(gfx: Graphics2D,
wenzelm@39175
   259
      first_line: Int, last_line: Int, physical_lines: Array[Int],
wenzelm@39175
   260
      start: Array[Int], end: Array[Int], y: Int, line_height: Int)
wenzelm@39175
   261
    {
wenzelm@43404
   262
      robust_body(()) {
wenzelm@46920
   263
        Swing_Thread.assert()
wenzelm@46920
   264
wenzelm@43404
   265
        val gutter = text_area.getGutter
wenzelm@43404
   266
        val width = GutterOptionPane.getSelectionAreaWidth
wenzelm@43404
   267
        val border_width = jEdit.getIntegerProperty("view.gutter.borderWidth", 3)
wenzelm@43404
   268
        val FOLD_MARKER_SIZE = 12
wenzelm@43419
   269
wenzelm@43404
   270
        if (gutter.isSelectionAreaEnabled && !gutter.isExpanded && width >= 12 && line_height >= 12) {
wenzelm@46920
   271
          Isabelle.buffer_lock(model.buffer) {
wenzelm@47027
   272
            val snapshot = model.snapshot()
wenzelm@43404
   273
            for (i <- 0 until physical_lines.length) {
wenzelm@43404
   274
              if (physical_lines(i) != -1) {
wenzelm@43404
   275
                val line_range = proper_line_range(start(i), end(i))
wenzelm@43419
   276
wenzelm@43404
   277
                // gutter icons
wenzelm@46178
   278
                Isabelle_Rendering.gutter_message(snapshot, line_range) match {
wenzelm@46178
   279
                  case Some(icon) =>
wenzelm@46227
   280
                    val x0 = (FOLD_MARKER_SIZE + width - border_width - icon.getIconWidth) max 10
wenzelm@46227
   281
                    val y0 = y + i * line_height + (((line_height - icon.getIconHeight) / 2) max 0)
wenzelm@46227
   282
                    icon.paintIcon(gutter, gfx, x0, y0)
wenzelm@46178
   283
                  case None =>
wenzelm@43404
   284
                }
wenzelm@39175
   285
              }
wenzelm@39175
   286
            }
wenzelm@39175
   287
          }
wenzelm@39175
   288
        }
wenzelm@39175
   289
      }
wenzelm@39175
   290
    }
wenzelm@39175
   291
  }
wenzelm@39175
   292
wenzelm@39175
   293
wenzelm@43448
   294
  /* caret range */
wenzelm@43448
   295
wenzelm@43448
   296
  def caret_range(): Text.Range =
wenzelm@46229
   297
    Isabelle.buffer_lock(model.buffer) {
wenzelm@46229
   298
      def text(i: Text.Offset): Char = model.buffer.getText(i, 1).charAt(0)
wenzelm@46229
   299
      val caret = text_area.getCaretPosition
wenzelm@46229
   300
      try {
wenzelm@46229
   301
        val c = text(caret)
wenzelm@46229
   302
        if (Character.isHighSurrogate(c) && Character.isLowSurrogate(text(caret + 1)))
wenzelm@46229
   303
          Text.Range(caret, caret + 2)
wenzelm@46229
   304
        else if (Character.isLowSurrogate(c) && Character.isHighSurrogate(text(caret - 1)))
wenzelm@46229
   305
          Text.Range(caret - 1, caret + 1)
wenzelm@46229
   306
        else Text.Range(caret, caret + 1)
wenzelm@46229
   307
      }
wenzelm@46229
   308
      catch { case _: ArrayIndexOutOfBoundsException => Text.Range(caret, caret + 1) }
wenzelm@43448
   309
    }
wenzelm@43448
   310
wenzelm@43448
   311
wenzelm@37129
   312
  /* caret handling */
wenzelm@34810
   313
wenzelm@37849
   314
  def selected_command(): Option[Command] =
wenzelm@38223
   315
  {
wenzelm@38223
   316
    Swing_Thread.require()
wenzelm@47027
   317
    model.snapshot().node.command_at(text_area.getCaretPosition).map(_._1)
wenzelm@38223
   318
  }
wenzelm@34810
   319
wenzelm@46740
   320
  private val delay_caret_update =
wenzelm@46740
   321
    Swing_Thread.delay_last(session.input_delay) {
wenzelm@44805
   322
      session.caret_focus.event(Session.Caret_Focus)
wenzelm@34810
   323
    }
wenzelm@46740
   324
wenzelm@46740
   325
  private val caret_listener = new CaretListener {
wenzelm@46740
   326
    override def caretUpdate(e: CaretEvent) { delay_caret_update(true) }
wenzelm@34810
   327
  }
wenzelm@34810
   328
wenzelm@34810
   329
wenzelm@46572
   330
  /* text status overview left of scrollbar */
wenzelm@34784
   331
wenzelm@46572
   332
  private val overview = new Text_Overview(this)
wenzelm@46572
   333
  {
wenzelm@46571
   334
    val delay_repaint =
wenzelm@46571
   335
      Swing_Thread.delay_first(Isabelle.session.update_delay) { repaint() }
wenzelm@34784
   336
  }
immler@34403
   337
wenzelm@34784
   338
wenzelm@39740
   339
  /* main actor */
wenzelm@39740
   340
wenzelm@39740
   341
  private val main_actor = actor {
wenzelm@39740
   342
    loop {
wenzelm@39740
   343
      react {
wenzelm@44608
   344
        case changed: Session.Commands_Changed =>
wenzelm@39740
   345
          val buffer = model.buffer
wenzelm@46918
   346
          Swing_Thread.later {
wenzelm@46918
   347
            Isabelle.buffer_lock(buffer) {
wenzelm@46918
   348
              if (model.buffer == text_area.getBuffer) {
wenzelm@47027
   349
                val snapshot = model.snapshot()
wenzelm@39740
   350
wenzelm@47027
   351
                if (changed.assignment ||
wenzelm@46918
   352
                    (changed.nodes.contains(model.name) &&
wenzelm@46918
   353
                     changed.commands.exists(snapshot.node.commands.contains)))
wenzelm@46918
   354
                  overview.delay_repaint(true)
wenzelm@39740
   355
wenzelm@46918
   356
                visible_range() match {
wenzelm@46918
   357
                  case Some(visible) =>
wenzelm@47027
   358
                    if (changed.assignment) invalidate_range(visible)
wenzelm@46918
   359
                    else {
wenzelm@46918
   360
                      val visible_cmds =
wenzelm@46918
   361
                        snapshot.node.command_range(snapshot.revert(visible)).map(_._1)
wenzelm@46918
   362
                      if (visible_cmds.exists(changed.commands)) {
wenzelm@46918
   363
                        for {
wenzelm@46918
   364
                          line <- 0 until text_area.getVisibleLines
wenzelm@46997
   365
                          start = text_area.getScreenLineStartOffset(line) if start >= 0
wenzelm@46997
   366
                          end = text_area.getScreenLineEndOffset(line) if end >= 0
wenzelm@46997
   367
                          range = proper_line_range(start, end)
wenzelm@46997
   368
                          line_cmds = snapshot.node.command_range(snapshot.revert(range)).map(_._1)
wenzelm@46918
   369
                          if line_cmds.exists(changed.commands)
wenzelm@46918
   370
                        } text_area.invalidateScreenLineRange(line, line)
wenzelm@46918
   371
                      }
wenzelm@46918
   372
                    }
wenzelm@46918
   373
                  case None =>
wenzelm@46583
   374
                }
wenzelm@46918
   375
              }
wenzelm@39740
   376
            }
wenzelm@39740
   377
          }
wenzelm@39740
   378
wenzelm@39740
   379
        case Session.Global_Settings => html_panel_resize()
wenzelm@39740
   380
wenzelm@39740
   381
        case bad => System.err.println("command_change_actor: ignoring bad message " + bad)
wenzelm@39740
   382
      }
wenzelm@39740
   383
    }
wenzelm@39740
   384
  }
wenzelm@39740
   385
wenzelm@39740
   386
wenzelm@34784
   387
  /* activation */
wenzelm@34784
   388
wenzelm@34808
   389
  private def activate()
wenzelm@34784
   390
  {
wenzelm@42825
   391
    val painter = text_area.getPainter
wenzelm@44437
   392
    painter.addExtension(TextAreaPainter.LOWEST_LAYER, update_perspective)
wenzelm@43387
   393
    painter.addExtension(TextAreaPainter.LINE_BACKGROUND_LAYER + 1, tooltip_painter)
wenzelm@43381
   394
    text_area_painter.activate()
wenzelm@42825
   395
    text_area.getGutter.addExtension(gutter_painter)
wenzelm@39131
   396
    text_area.addFocusListener(focus_listener)
wenzelm@39741
   397
    text_area.getView.addWindowListener(window_listener)
wenzelm@42825
   398
    painter.addMouseMotionListener(mouse_motion_listener)
wenzelm@34810
   399
    text_area.addCaretListener(caret_listener)
wenzelm@34810
   400
    text_area.addLeftOfScrollBar(overview)
wenzelm@39740
   401
    session.commands_changed += main_actor
wenzelm@39740
   402
    session.global_settings += main_actor
wenzelm@34784
   403
  }
wenzelm@34784
   404
wenzelm@34808
   405
  private def deactivate()
wenzelm@34784
   406
  {
wenzelm@42825
   407
    val painter = text_area.getPainter
wenzelm@39740
   408
    session.commands_changed -= main_actor
wenzelm@39740
   409
    session.global_settings -= main_actor
wenzelm@39131
   410
    text_area.removeFocusListener(focus_listener)
wenzelm@39741
   411
    text_area.getView.removeWindowListener(window_listener)
wenzelm@42825
   412
    painter.removeMouseMotionListener(mouse_motion_listener)
wenzelm@46740
   413
    text_area.removeCaretListener(caret_listener); delay_caret_update(false)
wenzelm@46740
   414
    text_area.removeLeftOfScrollBar(overview); overview.delay_repaint(false)
wenzelm@42825
   415
    text_area.getGutter.removeExtension(gutter_painter)
wenzelm@43381
   416
    text_area_painter.deactivate()
wenzelm@43381
   417
    painter.removeExtension(tooltip_painter)
wenzelm@44437
   418
    painter.removeExtension(update_perspective)
wenzelm@39740
   419
    exit_popup()
wenzelm@34784
   420
  }
wenzelm@42825
   421
}