editor.setSession must update wraplimit
This commit is contained in:
parent
09bda14096
commit
e32a760ef1
2 changed files with 20 additions and 17 deletions
|
|
@ -192,6 +192,7 @@ var Editor =function(renderer, session) {
|
|||
this.onChangeBackMarker();
|
||||
this.onChangeBreakpoint();
|
||||
this.onChangeAnnotation();
|
||||
this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
|
||||
this.renderer.scrollToRow(session.getScrollTopRow());
|
||||
this.renderer.updateFull();
|
||||
|
||||
|
|
|
|||
|
|
@ -201,13 +201,15 @@ var VirtualRenderer = function(container, theme) {
|
|||
*/
|
||||
this.onResize = function(force) {
|
||||
var changes = this.CHANGE_SIZE;
|
||||
var size = this.$size;
|
||||
|
||||
var height = dom.getInnerHeight(this.container);
|
||||
if (force || this.$size.height != height) {
|
||||
this.$size.height = height;
|
||||
if (force || size.height != height) {
|
||||
size.height = height;
|
||||
|
||||
this.scroller.style.height = height + "px";
|
||||
this.scrollBar.setHeight(this.scroller.clientHeight);
|
||||
size.scrollerHeight = this.scroller.clientHeight;
|
||||
this.scrollBar.setHeight(size.scrollerHeight);
|
||||
|
||||
if (this.session) {
|
||||
this.scrollToY(this.getScrollTop());
|
||||
|
|
@ -216,27 +218,27 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
|
||||
var width = dom.getInnerWidth(this.container);
|
||||
if (force || this.$size.width != width) {
|
||||
this.$size.width = width;
|
||||
if (force || size.width != width) {
|
||||
size.width = width;
|
||||
|
||||
var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
|
||||
this.scroller.style.left = gutterWidth + "px";
|
||||
this.scroller.style.width = Math.max(0, width - gutterWidth - this.scrollBar.getWidth()) + "px";
|
||||
size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth())
|
||||
this.scroller.style.width = size.scrollerWidth + "px";
|
||||
|
||||
if (this.session.getUseWrapMode()) {
|
||||
var availableWidth = this.scroller.clientWidth - this.$padding * 2;
|
||||
var limit = Math.floor(availableWidth / this.characterWidth) - 1;
|
||||
if (this.session.adjustWrapLimit(limit) || force) {
|
||||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
}
|
||||
if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
|
||||
changes = changes | this.CHANGE_FULL;
|
||||
}
|
||||
|
||||
this.$size.scrollerWidth = this.scroller.clientWidth;
|
||||
this.$size.scrollerHeight = this.scroller.clientHeight;
|
||||
this.$loop.schedule(changes);
|
||||
};
|
||||
|
||||
this.adjustWrapLimit = function(){
|
||||
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
|
||||
var limit = Math.floor(availableWidth / this.characterWidth) - 1;
|
||||
return this.session.adjustWrapLimit(limit);
|
||||
};
|
||||
|
||||
this.$onGutterClick = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
|
|
@ -420,7 +422,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.$textLayer.update(this.layerConfig);
|
||||
else
|
||||
this.$textLayer.scrollLines(this.layerConfig);
|
||||
|
||||
|
||||
if (this.showGutter)
|
||||
this.$gutterLayer.update(this.layerConfig);
|
||||
this.$markerBack.update(this.layerConfig);
|
||||
|
|
@ -767,7 +769,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
this.setTheme = function(theme) {
|
||||
var _self = this;
|
||||
|
||||
|
||||
this.$themeValue = theme;
|
||||
if (!theme || typeof theme == "string") {
|
||||
theme = theme || "ace/theme/textmate";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue