fix(web): correct getExtent
Co-authored-by: Will Lillis <will.lillis24@gmail.com>
This commit is contained in:
parent
45fa028201
commit
2814c00faa
1 changed files with 6 additions and 4 deletions
|
|
@ -396,14 +396,16 @@ function spliceInput(input, startIndex, lengthRemoved, newText) {
|
|||
];
|
||||
}
|
||||
|
||||
// Gets the extent of the text in terms of zero-based row and column numbers.
|
||||
function getExtent(text) {
|
||||
let row = 0;
|
||||
let index;
|
||||
for (index = 0; index !== -1; index = text.indexOf('\n', index)) {
|
||||
index++;
|
||||
let index = -1;
|
||||
let lastIndex = 0;
|
||||
while ((index = text.indexOf('\n', index + 1)) !== -1) {
|
||||
row++;
|
||||
lastIndex = index + 1;
|
||||
}
|
||||
return {row, column: text.length - index};
|
||||
return {row, column: text.length - lastIndex};
|
||||
}
|
||||
|
||||
function assertCursorState(cursor, params) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue