Skip to content

Commit e1bdccc

Browse files
committedApr 26, 2023
fix: replaceRange could now be implemented as an instance of the Range interface, rather than being an instance of the Range class
1 parent 990745a commit e1bdccc

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎src/snippets.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ var SnippetManager = function() {
483483
var processedSnippet = processSnippetText.call(this, editor, snippetText);
484484

485485
var range = editor.getSelectionRange();
486-
if (replaceRange && replaceRange.compareRange(range) === 0) {
486+
if (replaceRange && range.compareRange(replaceRange) === 0) {
487487
range = replaceRange;
488488
}
489489
var end = editor.session.replace(range, processedSnippet.text);

‎src/snippets_test.js

+8
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,14 @@ module.exports = {
328328
this.editor.tabstopManager.tabNext();
329329
editor.execCommand("insertstring", ".");
330330
assert.equal(editor.getValue(), "qt qt qt.");
331+
},
332+
"test: should work as expected with object of Range interface": function () {
333+
var content = "test";
334+
this.editor.setValue("replace1");
335+
snippetManager.insertSnippet(this.editor, content, {
336+
start: {row: 0, column: 0}, end: {row: 0, column: 7}
337+
});
338+
assert.equal(this.editor.getValue(), "test1");
331339
}
332340
};
333341

0 commit comments

Comments
 (0)
Please sign in to comment.