Fix bug where typing or pasting to extend the longest line causes the cursor and last character to be hidden
This commit is contained in:
parent
f811ef0b6f
commit
2f26407592
1 changed files with 9 additions and 3 deletions
|
|
@ -84,6 +84,7 @@ var VirtualRenderer = function(container, theme) {
|
||||||
this.lineHeight = textLayer.getLineHeight();
|
this.lineHeight = textLayer.getLineHeight();
|
||||||
|
|
||||||
this.$cursorLayer = new CursorLayer(this.content);
|
this.$cursorLayer = new CursorLayer(this.content);
|
||||||
|
this.$cursorPadding = 8;
|
||||||
|
|
||||||
this.layers = [ this.$markerLayer, textLayer, this.$cursorLayer ];
|
this.layers = [ this.$markerLayer, textLayer, this.$cursorLayer ];
|
||||||
|
|
||||||
|
|
@ -424,7 +425,8 @@ var VirtualRenderer = function(container, theme) {
|
||||||
var offset = this.scrollTop % this.lineHeight;
|
var offset = this.scrollTop % this.lineHeight;
|
||||||
var minHeight = this.$size.scrollerHeight + this.lineHeight;
|
var minHeight = this.$size.scrollerHeight + this.lineHeight;
|
||||||
|
|
||||||
var longestLine = this.$getLongestLine();
|
// Add some space for the cursor itself plus some cursor padding
|
||||||
|
var longestLine = this.$getLongestLine() + this.$cursorPadding + 3;
|
||||||
var widthChanged = !this.layerConfig ? true : (this.layerConfig.width != longestLine);
|
var widthChanged = !this.layerConfig ? true : (this.layerConfig.width != longestLine);
|
||||||
|
|
||||||
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
|
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
|
||||||
|
|
@ -560,8 +562,12 @@ var VirtualRenderer = function(container, theme) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left
|
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left
|
||||||
+ this.characterWidth) {
|
+ this.characterWidth + this.$cursorPadding) {
|
||||||
this.scrollToX(Math.round(left + this.characterWidth
|
|
||||||
|
if (left + this.characterWidth + this.$cursorPadding > this.scroller.scrollWidth)
|
||||||
|
this.$renderChanges(this.CHANGE_SIZE);
|
||||||
|
|
||||||
|
this.scrollToX(Math.round(left + this.characterWidth + this.$cursorPadding
|
||||||
- this.$size.scrollerWidth));
|
- this.$size.scrollerWidth));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue