Merge branch 'missing-redraw'
This commit is contained in:
commit
ec6ffec1e4
3 changed files with 16 additions and 11 deletions
|
|
@ -36,8 +36,6 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
|
||||
*
|
||||
* If a certain row is changed, everything below that row is re-tokenized.
|
||||
|
|
@ -50,8 +48,6 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
* @param {Tokenizer} tokenizer The tokenizer to use
|
||||
* @param {Editor} editor The editor to associate with
|
||||
*
|
||||
*
|
||||
*
|
||||
* @constructor
|
||||
**/
|
||||
|
||||
|
|
@ -89,10 +85,9 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
|
||||
// only check every 5 lines
|
||||
processedLines ++;
|
||||
if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
|
||||
if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) {
|
||||
self.running = setTimeout(self.$worker, 20);
|
||||
self.currentLine = currentLine;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
self.currentLine = currentLine;
|
||||
|
|
|
|||
|
|
@ -702,12 +702,13 @@ var Editor = function(renderer, session) {
|
|||
lastRow = range.end.row;
|
||||
else
|
||||
lastRow = Infinity;
|
||||
this.renderer.updateLines(range.start.row, lastRow);
|
||||
this.renderer.updateLines(range.start.row, lastRow, this.session.$useWrapMode);
|
||||
|
||||
this._signal("change", e);
|
||||
|
||||
// update cursor because tab characters can influence the cursor position
|
||||
this.$cursorChange();
|
||||
this.$updateHighlightActiveLine();
|
||||
};
|
||||
|
||||
this.onTokenizerUpdate = function(e) {
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
*
|
||||
*
|
||||
**/
|
||||
this.updateLines = function(firstRow, lastRow) {
|
||||
this.updateLines = function(firstRow, lastRow, force) {
|
||||
if (lastRow === undefined)
|
||||
lastRow = Infinity;
|
||||
|
||||
|
|
@ -276,8 +276,17 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$changedLines.lastRow = lastRow;
|
||||
}
|
||||
|
||||
if (this.$changedLines.firstRow > this.layerConfig.lastRow ||
|
||||
this.$changedLines.lastRow < this.layerConfig.firstRow)
|
||||
// If the change happened offscreen above us then it's possible
|
||||
// that a new line wrap will affect the position of the lines on our
|
||||
// screen so they need redrawn.
|
||||
// TODO: better solution is to not change scroll position when text is changed outside of visible area
|
||||
if (this.$changedLines.lastRow < this.layerConfig.firstRow) {
|
||||
if (force)
|
||||
this.$changedLines.lastRow = this.layerConfig.lastRow;
|
||||
else
|
||||
return;
|
||||
}
|
||||
if (this.$changedLines.firstRow > this.layerConfig.lastRow)
|
||||
return;
|
||||
this.$loop.schedule(this.CHANGE_LINES);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue