hack edit session
This commit is contained in:
parent
a56c3b44b5
commit
1ac4ea51e2
2 changed files with 33 additions and 0 deletions
|
|
@ -1037,8 +1037,20 @@ var EditSession = function(text, mode) {
|
|||
**/
|
||||
this.getScreenWidth = function() {
|
||||
this.$computeWidth();
|
||||
if (this.lineWidgets)
|
||||
return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth);
|
||||
return this.screenWidth;
|
||||
};
|
||||
|
||||
this.getLineWidgetMaxWidth = function() {
|
||||
if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth
|
||||
var width = 0;
|
||||
this.lineWidgets.forEach(function(w) {
|
||||
if (w && w.screenWidth > width)
|
||||
width = w.screenWidth;
|
||||
});
|
||||
return this.lineWidgetWidth = width;
|
||||
}
|
||||
|
||||
this.$computeWidth = function(force) {
|
||||
if (this.$modified || force) {
|
||||
|
|
@ -2043,6 +2055,7 @@ var EditSession = function(text, mode) {
|
|||
return [screenColumn, column];
|
||||
};
|
||||
|
||||
this.lineWidgets = null;
|
||||
/**
|
||||
* Returns number of screenrows in a wrapped line.
|
||||
* @param {Number} row The row number to check
|
||||
|
|
@ -2050,6 +2063,17 @@ var EditSession = function(text, mode) {
|
|||
* @returns {Number}
|
||||
**/
|
||||
this.getRowLength = function(row) {
|
||||
if (this.lineWidgets)
|
||||
var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0;
|
||||
else
|
||||
h = 0
|
||||
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
||||
return 1 + h;
|
||||
} else {
|
||||
return this.$wrapData[row].length + 1 + h;
|
||||
}
|
||||
};
|
||||
this.getRowLineCount = function(row) {
|
||||
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
||||
return 1;
|
||||
} else {
|
||||
|
|
@ -2372,6 +2396,10 @@ var EditSession = function(text, mode) {
|
|||
}
|
||||
}
|
||||
|
||||
// todo
|
||||
if (this.lineWidgets)
|
||||
screenRows += this.$getWidgetScreenLength();
|
||||
|
||||
return screenRows;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -783,6 +783,11 @@ var Selection = function(session) {
|
|||
}
|
||||
|
||||
var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
|
||||
|
||||
if (rows != 0 && chars == 0 && docPos.row == screenPos.row && docPos.column == screenPos.column) {
|
||||
if (this.session.lineWidgets && this.session.lineWidgets[docPos.row])
|
||||
docPos.row++;
|
||||
}
|
||||
|
||||
// move the cursor and update the desired column
|
||||
this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue