Split editor action does not show as disabled when limit hit (fixes #7651)

This commit is contained in:
Benjamin Pasero
2016-06-14 12:41:29 +02:00
parent ad55bcd31b
commit 2e449867f3

View File

@@ -89,7 +89,37 @@ export abstract class TitleControl {
this.initActions();
}
private updateActionEnablement(): void {
if (!this.context) {
return;
}
const group = this.context;
const groupCount = this.stacks.groups.length;
// Move group
switch (this.stacks.positionOfGroup(group)) {
case Position.LEFT:
this.moveGroupLeftAction.enabled = false;
this.moveGroupRightAction.enabled = this.stacks.groups.length > 1;
break;
case Position.CENTER:
this.moveGroupRightAction.enabled = this.stacks.groups.length > 2;
break;
case Position.RIGHT:
this.moveGroupRightAction.enabled = false;
break;
}
// Split editor
this.splitEditorAction.enabled = groupCount < 3;
}
private onSchedule(): void {
this.updateActionEnablement();
if (this.refreshScheduled) {
this.doRefresh();
} else {
@@ -294,22 +324,6 @@ export abstract class TitleControl {
primary.push(this.splitEditorAction);
}
// Make sure enablement is good
switch (this.stacks.positionOfGroup(group)) {
case Position.LEFT:
this.moveGroupLeftAction.enabled = false;
this.moveGroupRightAction.enabled = this.stacks.groups.length > 1;
break;
case Position.CENTER:
this.moveGroupRightAction.enabled = this.stacks.groups.length > 2;
break;
case Position.RIGHT:
this.moveGroupRightAction.enabled = false;
break;
}
// Return actions
const secondary = [
this.moveGroupLeftAction,