Clamp column returned by Document.screenToDocumentPosition
This commit is contained in:
parent
c6b32c96ef
commit
be957fd2c1
1 changed files with 5 additions and 1 deletions
|
|
@ -1027,10 +1027,14 @@ var Document = function(text, mode) {
|
|||
row -= wrapData[docRow].length + 1;
|
||||
docRow ++;
|
||||
}
|
||||
|
||||
var docColumn = column +
|
||||
(docRow < linesCount ? wrapData[docRow][row - 1] || 0 : 0);
|
||||
|
||||
if (this.lines[docRow]) {
|
||||
// Clamp docColumn.
|
||||
if (docRow < linesCount && wrapData[docRow][row]) {
|
||||
docColumn = Math.min(docColumn, wrapData[docRow][row]);
|
||||
} else if (this.lines[docRow]) {
|
||||
docColumn = Math.min(docColumn, this.lines[docRow].length);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue