cursor on the right side of the screen should be visible

This commit is contained in:
Fabian Jakobs 2011-02-11 08:21:17 +01:00
commit 6be525c3f8

View file

@ -425,8 +425,7 @@ var VirtualRenderer = function(container, theme) {
var offset = this.scrollTop % this.lineHeight;
var minHeight = this.$size.scrollerHeight + this.lineHeight;
// Add some space for the cursor itself plus some cursor padding
var longestLine = this.$getLongestLine() + this.$cursorPadding + 3;
var longestLine = this.$getLongestLine();
var widthChanged = !this.layerConfig ? true : (this.layerConfig.width != longestLine);
var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
@ -491,7 +490,7 @@ var VirtualRenderer = function(container, theme) {
};
this.$getLongestLine = function() {
var charCount = this.session.getScreenWidth();
var charCount = this.session.getScreenWidth() + 1;
if (this.$textLayer.showInvisibles)
charCount += 1;
@ -561,14 +560,12 @@ var VirtualRenderer = function(container, theme) {
this.scrollToX(left);
}
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left
+ this.characterWidth + this.$cursorPadding) {
if (this.scroller.scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
if (left + this.characterWidth + this.$cursorPadding > this.scroller.scrollWidth)
if (left + this.characterWidth > this.scroller.scrollWidth)
this.$renderChanges(this.CHANGE_SIZE);
this.scrollToX(Math.round(left + this.characterWidth + this.$cursorPadding
- this.$size.scrollerWidth));
this.scrollToX(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
}
},