Skip to content

Commit 069b322

Browse files
author
Dmitriy Kubyshkin
committed
Fixed issue with removing lines at the end of the document.
1 parent 14fc582 commit 069b322

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/CanvasTextEditor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ CanvasTextEditor.prototype.render = function() {
207207
var baselineOffset = this._metrics.getBaseline(),
208208
lineHeight = this._metrics.getHeight(),
209209
characterWidth = this._metrics.getWidth(),
210-
maxHeight = Math.ceil(this.canvas.height / lineHeight),
210+
maxHeight = Math.ceil(this.canvas.height / lineHeight) + this._scrollTop,
211211
lineCount = this._document.getLineCount(),
212212
selectionRanges = this._selection.lineRanges(),
213213
selectionWidth = 0;
214214

215-
// Making sure we don't render somethign that we won't see
215+
// Making sure we don't render something that we won't see
216216
if (lineCount < maxHeight) maxHeight = lineCount;
217217

218218
// Clearing previous iteration
@@ -221,7 +221,7 @@ CanvasTextEditor.prototype.render = function() {
221221
this.context.fillStyle = this.options.textColor;
222222

223223
// Looping over document lines
224-
for(var i = this._scrollTop; i < maxHeight + this._scrollTop; ++i) {
224+
for(var i = this._scrollTop; i < maxHeight; ++i) {
225225
var topOffset = lineHeight * (i - this._scrollTop);
226226

227227
// Rendering selection for this line if one is present

0 commit comments

Comments
 (0)