Permalink
Browse files

Fix bug in document iteration over subviews

Closes #1252
  • Loading branch information...
1 parent e12fbcb commit 853093b7743f3435bf3dd18dab276114bb981682 @marijnh marijnh committed Feb 18, 2013
Showing with 8 additions and 1 deletion.
  1. +1 −1 lib/codemirror.js
  2. +7 −0 test/doc_test.js
View
@@ -4283,7 +4283,7 @@ window.CodeMirror = (function() {
Doc.prototype = createObj(BranchChunk.prototype, {
iter: function(from, to, op) {
- if (op) this.iterN(from - this.first, to - (from - this.first), op);
+ if (op) this.iterN(from - this.first, to - from, op);
else this.iterN(this.first, this.first + this.size, from);
},
View
@@ -319,4 +319,11 @@
eq(mark.find(), null);
eq(cleared, 1);
});
+
+ testDoc("undoInSubview", "A='line 0\nline 1\nline 2\nline 3\nline 4' B<A/1-4", function(a, b) {
+ b.replaceRange("x", Pos(2, 0));
+ a.undo();
+ eq(a.getValue(), "line 0\nline 1\nline 2\nline 3\nline 4");
+ eq(b.getValue(), "line 1\nline 2\nline 3");
+ });
})();

0 comments on commit 853093b

Please sign in to comment.