From 6be525c3f8323271f6f8fec85ec56b2c40938fce Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Fri, 11 Feb 2011 08:21:17 +0100 Subject: [PATCH] cursor on the right side of the screen should be visible --- lib/ace/virtual_renderer.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index 02ea0745..a432bd3f 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -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)); } },