initDefaultWidht() for various views

This commit is contained in:
Bryan Ashby
2018-06-23 22:23:22 -06:00
parent 0cfd45d8a9
commit 3aa23db306
8 changed files with 16 additions and 2 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ function ButtonView(options) {
TextView.call(this, options);
this.dimens.width = this.dimens.width || Math.min(10, this.client.term.termWidth - this.position.col);
this.initDefaultWidth();
}
util.inherits(ButtonView, TextView);
+2
View File
@@ -19,6 +19,8 @@ function EditTextView(options) {
TextView.call(this, options);
this.initDefaultWidth();
this.cursorPos = { row : 0, col : 0 };
this.clientBackspace = function() {
+2
View File
@@ -35,6 +35,8 @@ function MaskEditTextView(options) {
TextView.call(this, options);
this.initDefaultWidth();
this.cursorPos = { x : 0 };
this.patternArrayPos = 0;
+2
View File
@@ -97,6 +97,8 @@ function MultiLineEditTextView(options) {
View.call(this, options);
this.initDefaultWidth();
var self = this;
//
+2
View File
@@ -17,6 +17,8 @@ function SpinnerMenuView(options) {
MenuView.call(this, options);
this.initDefaultWidth();
var self = this;
/*
+2
View File
@@ -14,6 +14,8 @@ function ToggleMenuView (options) {
MenuView.call(this, options);
this.initDefaultWidth();
var self = this;
/*
+1 -1
View File
@@ -20,7 +20,7 @@ function VerticalMenuView(options) {
MenuView.call(this, options);
this.dimens.width = this.dimens.width || Math.min(15, this.client.term.termWidth - this.position.col);
this.initDefaultWidth();
const self = this;
+4
View File
@@ -100,6 +100,10 @@ function View(options) {
//this.client.term.write(ansi.setCursorStyle(this.cursorStyle));
this.client.term.rawWrite('show' === this.cursor ? ansi.showCursor() : ansi.hideCursor());
};
this.initDefaultWidth = function(width = 15) {
this.dimens.width = this.dimens.width || Math.min(width, this.client.term.termWidth - this.position.col);
};
}
util.inherits(View, events.EventEmitter);