Fix to cursor height for wrapped lines

Avoids issue caused by for non diff height styled lines
This commit is contained in:
Matt Pass
2014-11-07 22:00:12 +00:00
parent d66d41b17f
commit 3d0625231f
2 changed files with 97 additions and 75 deletions

View File

@@ -269,7 +269,29 @@ var ICEcoder = {
}
// Set the cursor to text height, not line height
setTimeout(function() {
thisCM.setOption("cursorHeight",thisCM.defaultTextHeight() / thisCM.lineInfo(thisCM.getCursor().line).handle.height);
var paneMatch;
// Loop through styles to check if we have to adjust cursor height
for (var i=0; i<top.ICEcoder.renderLineStyle.length; i++) {
// We have no matching pane to start with
paneMatch = false;
// Is the pane we need to set the cursor on this pane?
if (
(top.ICEcoder.renderLineStyle[i][0] != "diff" && cMinstance.indexOf("diff") == -1) ||
(top.ICEcoder.renderLineStyle[i][0] == "diff" && cMinstance.indexOf("diff") > -1)
)
{paneMatch = true;}
// If the pane matches & also the line we're on is the line we have a style set for, set that cursor height
if (paneMatch && thisCM.getCursor().line+1 == top.ICEcoder.renderLineStyle[i][1]) {
thisCM.setOption("cursorHeight",thisCM.defaultTextHeight() / thisCM.lineInfo(thisCM.getCursor().line).handle.height);
} else {
thisCM.setOption("cursorHeight",1);
}
}
},0);
},