Skip to content
Snippets Groups Projects
Commit c41d05e2 authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

[merge addon] Realign when a redraw updates a previously estimated line height

Closes #4621
parent 8d552508
No related branches found
No related tags found
No related merge requests found
......@@ -828,6 +828,7 @@
function TrackAlignable(cm) {
this.cm = cm
this.alignable = []
this.height = cm.doc.height
var self = this
cm.on("markerAdded", function(_, marker) {
if (!marker.collapsed) return
......@@ -857,11 +858,15 @@
self.check(end, F_MARKER, self.hasMarker)
if (nBefore || nAfter) self.check(change.from.line, F_MARKER, self.hasMarker)
})
cm.on("viewportChange", function() {
if (self.cm.doc.height != self.height) self.signal()
})
}
TrackAlignable.prototype = {
signal: function() {
CodeMirror.signal(this, "realign")
this.height = this.cm.doc.height
},
set: function(n, flags) {
......
......@@ -64,7 +64,7 @@ the <a href="https://code.google.com/p/google-diff-match-patch/">google-diff-mat
library to compute the diffs.</p>
<script>
var value, orig1, orig2, dv, panes = 2, highlight = true, connect = null, collapse = false;
var value, orig1, orig2, dv, panes = 2, highlight = true, connect = "align", collapse = false;
function initUI() {
if (value == null) return;
var target = document.getElementById("view");
......@@ -91,6 +91,7 @@ window.onload = function() {
orig2 = value.replace(/\u003cscript/g, "\u003cscript type=text/javascript ")
.replace("white", "purple;\n font: comic sans;\n text-decoration: underline;\n height: 15em");
initUI();
let d = document.createElement("div"); d.style.cssText = "width: 50px; margin: 7px; height: 14px"; dv.editor().addLineWidget(57, d)
};
function mergeViewHeight(mergeView) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment