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;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue