author | immler@in.tum.de |
Thu, 19 Feb 2009 20:44:28 +0100 | |
changeset 34526 | b504abb6eff6 |
parent 34524 | 06a18bcf4e74 |
child 34532 | aaafe9c4180b |
permissions | -rw-r--r-- |
34407 | 1 |
/* |
34408 | 2 |
* jEdit text area as document text source |
34407 | 3 |
* |
4 |
* @author Fabian Immler, TU Munich |
|
5 |
* @author Johannes Hölzl, TU Munich |
|
34447 | 6 |
* @author Makarius |
34407 | 7 |
*/ |
8 |
||
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
9 |
package isabelle.jedit |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
10 |
|
34446 | 11 |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
12 |
import isabelle.proofdocument.Text |
34452 | 13 |
import isabelle.prover.{Prover, Command} |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
14 |
|
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
15 |
import java.awt.Graphics2D |
34446 | 16 |
import java.awt.event.{ActionEvent, ActionListener} |
17 |
import java.awt.Color |
|
34447 | 18 |
import javax.swing.Timer |
19 |
import javax.swing.event.{CaretListener, CaretEvent} |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
20 |
|
34446 | 21 |
import org.gjt.sp.jedit.buffer.{BufferListener, JEditBuffer} |
22 |
import org.gjt.sp.jedit.textarea.{JEditTextArea, TextAreaExtension, TextAreaPainter} |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
23 |
import org.gjt.sp.jedit.syntax.SyntaxStyle |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
24 |
|
34446 | 25 |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
26 |
object TheoryView { |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
27 |
|
34446 | 28 |
def choose_color(state: Command): Color = { |
34448 | 29 |
if (state == null) Color.red |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
30 |
else |
34458
e2aa32bb73c0
- renamed Command.Phase to Command.Status (cf. src/Pure/Isar/isar.ML);
wenzelm
parents:
34457
diff
changeset
|
31 |
state.status match { |
e2aa32bb73c0
- renamed Command.Phase to Command.Status (cf. src/Pure/Isar/isar.ML);
wenzelm
parents:
34457
diff
changeset
|
32 |
case Command.Status.UNPROCESSED => new Color(255, 228, 225) |
e2aa32bb73c0
- renamed Command.Phase to Command.Status (cf. src/Pure/Isar/isar.ML);
wenzelm
parents:
34457
diff
changeset
|
33 |
case Command.Status.FINISHED => new Color(234, 248, 255) |
e2aa32bb73c0
- renamed Command.Phase to Command.Status (cf. src/Pure/Isar/isar.ML);
wenzelm
parents:
34457
diff
changeset
|
34 |
case Command.Status.FAILED => new Color(255, 192, 192) |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
35 |
case _ => Color.red |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
36 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
37 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
38 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
39 |
|
34446 | 40 |
|
41 |
class TheoryView (text_area: JEditTextArea) |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
42 |
extends TextAreaExtension with Text with BufferListener { |
34406
f81cd75ae331
restructured: independent provers in different buffers
immler@in.tum.de
parents:
34405
diff
changeset
|
43 |
|
34446 | 44 |
private val buffer = text_area.getBuffer |
34475
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34458
diff
changeset
|
45 |
private val prover = Isabelle.prover_setup(buffer).get.prover |
34406
f81cd75ae331
restructured: independent provers in different buffers
immler@in.tum.de
parents:
34405
diff
changeset
|
46 |
buffer.addBufferListener(this) |
34446 | 47 |
|
48 |
||
34526 | 49 |
private var col: Text.Change = null |
34446 | 50 |
|
51 |
private val col_timer = new Timer(300, new ActionListener() { |
|
34515
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
52 |
override def actionPerformed(e: ActionEvent) = commit |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
53 |
}) |
34406
f81cd75ae331
restructured: independent provers in different buffers
immler@in.tum.de
parents:
34405
diff
changeset
|
54 |
|
34446 | 55 |
col_timer.stop |
56 |
col_timer.setRepeats(true) |
|
57 |
||
58 |
||
34513 | 59 |
private val phase_overview = new PhaseOverviewPanel(prover, to_current(_)) |
34446 | 60 |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
61 |
|
34446 | 62 |
/* activation */ |
63 |
||
34517 | 64 |
Isabelle.plugin.font_changed += (_ => update_styles) |
34446 | 65 |
|
34517 | 66 |
private def update_styles = { |
34406
f81cd75ae331
restructured: independent provers in different buffers
immler@in.tum.de
parents:
34405
diff
changeset
|
67 |
if (text_area != null) { |
34440 | 68 |
if (Isabelle.plugin.font != null) { |
34524 | 69 |
text_area.getPainter.setStyles(DynamicTokenMarker.reload_styles) |
34517 | 70 |
repaint_all |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
71 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
72 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
73 |
} |
34446 | 74 |
|
75 |
private val selected_state_controller = new CaretListener { |
|
76 |
override def caretUpdate(e: CaretEvent) = { |
|
34496
1b2995592bb9
renamed getNextCommandContaining to find_command_at;
wenzelm
parents:
34475
diff
changeset
|
77 |
val cmd = prover.document.find_command_at(e.getDot) |
34446 | 78 |
if (cmd != null && cmd.start <= e.getDot && |
34475
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34458
diff
changeset
|
79 |
Isabelle.prover_setup(buffer).get.selected_state != cmd) |
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34458
diff
changeset
|
80 |
Isabelle.prover_setup(buffer).get.selected_state = cmd |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
81 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
82 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
83 |
|
34446 | 84 |
def activate() = { |
85 |
text_area.addCaretListener(selected_state_controller) |
|
86 |
phase_overview.textarea = text_area |
|
87 |
text_area.addLeftOfScrollBar(phase_overview) |
|
88 |
text_area.getPainter.addExtension(TextAreaPainter.LINE_BACKGROUND_LAYER + 1, this) |
|
34517 | 89 |
buffer.setTokenMarker(new DynamicTokenMarker(buffer, prover.document)) |
90 |
update_styles |
|
34526 | 91 |
changes.event(new Text.Change(0,buffer.getText(0, buffer.getLength),0)) |
34446 | 92 |
} |
93 |
||
94 |
def deactivate() = { |
|
95 |
text_area.getPainter.removeExtension(this) |
|
96 |
text_area.removeLeftOfScrollBar(phase_overview) |
|
97 |
text_area.removeCaretListener(selected_state_controller) |
|
98 |
} |
|
99 |
||
100 |
||
101 |
/* painting */ |
|
102 |
||
103 |
val repaint_delay = new isabelle.utils.Delay(100, () => repaint_all()) |
|
34475
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34458
diff
changeset
|
104 |
prover.command_info += (_ => repaint_delay.delay_or_ignore()) |
34446 | 105 |
|
34517 | 106 |
def from_current (pos: Int) = |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
107 |
if (col != null && col.start <= pos) |
34526 | 108 |
if (pos < col.start + col.added.length) col.start |
109 |
else pos - col.added.length + col.removed |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
110 |
else pos |
34446 | 111 |
|
34517 | 112 |
def to_current (pos : Int) = |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
113 |
if (col != null && col.start <= pos) |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
114 |
if (pos < col.start + col.removed) col.start |
34526 | 115 |
else pos + col.added.length - col.removed |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
116 |
else pos |
34446 | 117 |
|
118 |
def repaint(cmd: Command) = |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
119 |
{ |
34507 | 120 |
if (text_area != null) { |
34446 | 121 |
val start = text_area.getLineOfOffset(to_current(cmd.start)) |
122 |
val stop = text_area.getLineOfOffset(to_current(cmd.stop) - 1) |
|
34406
f81cd75ae331
restructured: independent provers in different buffers
immler@in.tum.de
parents:
34405
diff
changeset
|
123 |
text_area.invalidateLineRange(start, stop) |
34446 | 124 |
|
34475
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34458
diff
changeset
|
125 |
if (Isabelle.prover_setup(buffer).get.selected_state == cmd) |
f963335dbc6b
implemented IsabelleSideKickParser.complete
immler@in.tum.de
parents:
34458
diff
changeset
|
126 |
Isabelle.prover_setup(buffer).get.selected_state = cmd // update State view |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
127 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
128 |
} |
34446 | 129 |
|
130 |
def repaint_all() = |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
131 |
{ |
34406
f81cd75ae331
restructured: independent provers in different buffers
immler@in.tum.de
parents:
34405
diff
changeset
|
132 |
if (text_area != null) |
34446 | 133 |
text_area.invalidateLineRange(text_area.getFirstPhysicalLine, text_area.getLastPhysicalLine) |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
134 |
} |
34391 | 135 |
|
34446 | 136 |
def encolor(gfx: Graphics2D, |
137 |
y: Int, height: Int, begin: Int, finish: Int, color: Color, fill: Boolean) = |
|
138 |
{ |
|
139 |
val start = text_area.offsetToXY(begin) |
|
140 |
val stop = |
|
141 |
if (finish < buffer.getLength) text_area.offsetToXY(finish) |
|
142 |
else { |
|
143 |
val p = text_area.offsetToXY(finish - 1) |
|
34515
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
144 |
val metrics = text_area.getPainter.getFontMetrics |
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
145 |
p.x = p.x + (metrics.charWidth(' ') max metrics.getMaxAdvance) |
34446 | 146 |
p |
34391 | 147 |
} |
34446 | 148 |
|
149 |
if (start != null && stop != null) { |
|
150 |
gfx.setColor(color) |
|
151 |
if (fill) gfx.fillRect(start.x, y, stop.x - start.x, height) |
|
152 |
else gfx.drawRect(start.x, y, stop.x - start.x, height) |
|
153 |
} |
|
34391 | 154 |
} |
155 |
||
34446 | 156 |
|
157 |
/* TextAreaExtension methods */ |
|
158 |
||
159 |
override def paintValidLine(gfx: Graphics2D, |
|
34450 | 160 |
screen_line: Int, physical_line: Int, start: Int, end: Int, y: Int) = |
34446 | 161 |
{ |
162 |
val saved_color = gfx.getColor |
|
163 |
||
164 |
val metrics = text_area.getPainter.getFontMetrics |
|
34496
1b2995592bb9
renamed getNextCommandContaining to find_command_at;
wenzelm
parents:
34475
diff
changeset
|
165 |
var e = prover.document.find_command_at(from_current(start)) |
34526 | 166 |
val commands = prover.document.commands.dropWhile(_.stop <= from_current(start)). |
167 |
takeWhile(c => to_current(c.start) < end) |
|
34446 | 168 |
// encolor phase |
34526 | 169 |
for (e <- commands) { |
34446 | 170 |
val begin = start max to_current(e.start) |
171 |
val finish = end - 1 min to_current(e.stop) |
|
172 |
encolor(gfx, y, metrics.getHeight, begin, finish, TheoryView.choose_color(e), true) |
|
173 |
||
34391 | 174 |
// paint details of command |
34446 | 175 |
for (node <- e.root_node.dfs) { |
176 |
val begin = to_current(node.start + e.start) |
|
34514
2104a836b415
renamed fields of MarkupNode; implemented flatten and leafs
immler@in.tum.de
parents:
34513
diff
changeset
|
177 |
val finish = to_current(node.stop + e.start) |
34446 | 178 |
if (finish > start && begin < end) { |
34517 | 179 |
encolor(gfx, y + metrics.getHeight - 2, 1, begin max start, finish min end - 1, |
180 |
DynamicTokenMarker.choose_color(node.kind), true) |
|
34446 | 181 |
} |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
182 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
183 |
} |
34391 | 184 |
|
34446 | 185 |
gfx.setColor(saved_color) |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
186 |
} |
34446 | 187 |
|
188 |
||
189 |
/* Text methods */ |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
190 |
|
34446 | 191 |
def content(start: Int, stop: Int) = buffer.getText(start, stop - start) |
192 |
def length = buffer.getLength |
|
34526 | 193 |
val changes = new EventBus[Text.Change] |
34446 | 194 |
|
195 |
||
196 |
/* BufferListener methods */ |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
197 |
|
34515
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
198 |
private def commit { |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
199 |
if (col != null) |
34456 | 200 |
changes.event(col) |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
201 |
col = null |
34446 | 202 |
if (col_timer.isRunning()) |
203 |
col_timer.stop() |
|
204 |
} |
|
205 |
||
34515
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
206 |
private def delay_commit { |
34446 | 207 |
if (col_timer.isRunning()) |
208 |
col_timer.restart() |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
209 |
else |
34446 | 210 |
col_timer.start() |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
211 |
} |
34446 | 212 |
|
213 |
||
214 |
override def contentInserted(buffer: JEditBuffer, |
|
215 |
start_line: Int, offset: Int, num_lines: Int, length: Int) { } |
|
216 |
||
217 |
override def contentRemoved(buffer: JEditBuffer, |
|
218 |
start_line: Int, offset: Int, num_lines: Int, length: Int) { } |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
219 |
|
34446 | 220 |
override def preContentInserted(buffer: JEditBuffer, |
221 |
start_line: Int, offset: Int, num_lines: Int, length: Int) = |
|
222 |
{ |
|
34526 | 223 |
val text = buffer.getText(offset, length) |
34364 | 224 |
if (col == null) |
34526 | 225 |
col = new Text.Change(offset, text, 0) |
226 |
else if (col.start <= offset && offset <= col.start + col.added.length) |
|
227 |
col = new Text.Change(col.start, col.added + text, col.removed) |
|
34446 | 228 |
else { |
34515
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
229 |
commit |
34526 | 230 |
col = new Text.Change(offset, text, 0) |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
231 |
} |
34515
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
232 |
delay_commit |
34446 | 233 |
} |
234 |
||
235 |
override def preContentRemoved(buffer: JEditBuffer, |
|
236 |
start_line: Int, start: Int, num_lines: Int, removed: Int) = |
|
237 |
{ |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
238 |
if (col == null) |
34526 | 239 |
col = new Text.Change(start, "", removed) |
240 |
else if (col.start > start + removed || start > col.start + col.added.length) { |
|
34515
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
241 |
commit |
34526 | 242 |
col = new Text.Change(start, "", removed) |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
243 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
244 |
else { |
34526 | 245 |
/* val offset = start - col.start |
246 |
val diff = col.added.length - removed |
|
34446 | 247 |
val (added, add_removed) = |
248 |
if (diff < offset) |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
249 |
(offset max 0, diff - (offset max 0)) |
34446 | 250 |
else |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
251 |
(diff - (offset min 0), offset min 0) |
34526 | 252 |
col = new Text.Changed(start min col.start, added, col.removed - add_removed)*/ |
253 |
commit |
|
254 |
col = new Text.Change(start, "", removed) |
|
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
255 |
} |
34515
3be515f1379d
use FontMetrics.getMaxAdvance if available; tuned
immler@in.tum.de
parents:
34514
diff
changeset
|
256 |
delay_commit |
34318
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
257 |
} |
c13e168a8ae6
original sources from Johannes Hölzl a48e0c6ab1aea77c52d596f7efc007a543d3d10c with minor modifications of directory layout;
wenzelm
parents:
diff
changeset
|
258 |
|
34446 | 259 |
override def bufferLoaded(buffer: JEditBuffer) { } |
260 |
override def foldHandlerChanged(buffer: JEditBuffer) { } |
|
261 |
override def foldLevelChanged(buffer: JEditBuffer, start_line: Int, end_line: Int) { } |
|
262 |
override def transactionComplete(buffer: JEditBuffer) { } |
|
34447 | 263 |
} |