parent
478a8a994a
commit
e82ec724e1
|
@ -1,15 +1,14 @@
|
||||||
/* jslint node: true */
|
/* jslint node: true */
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var View = require('./view.js').View;
|
const View = require('./view.js').View;
|
||||||
var miscUtil = require('./misc_util.js');
|
const strUtil = require('./string_util.js');
|
||||||
var strUtil = require('./string_util.js');
|
const ansi = require('./ansi_term.js');
|
||||||
var ansi = require('./ansi_term.js');
|
const colorCodes = require('./color_codes.js');
|
||||||
var colorCodes = require('./color_codes.js');
|
const wordWrapText = require('./word_wrap.js').wordWrapText;
|
||||||
var wordWrapText = require('./word_wrap.js').wordWrapText;
|
|
||||||
|
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
var _ = require('lodash');
|
const _ = require('lodash');
|
||||||
|
|
||||||
// :TODO: Determine CTRL-* keys for various things
|
// :TODO: Determine CTRL-* keys for various things
|
||||||
// See http://www.bbsdocumentary.com/library/PROGRAMS/GRAPHICS/ANSI/bansi.txt
|
// See http://www.bbsdocumentary.com/library/PROGRAMS/GRAPHICS/ANSI/bansi.txt
|
||||||
|
@ -114,10 +113,10 @@ function MultiLineEditTextView(options) {
|
||||||
this.topVisibleIndex = 0;
|
this.topVisibleIndex = 0;
|
||||||
this.mode = options.mode || 'edit'; // edit | preview | read-only
|
this.mode = options.mode || 'edit'; // edit | preview | read-only
|
||||||
|
|
||||||
if (this.mode == 'edit') {
|
if ('preview' === this.mode) {
|
||||||
this.autoScroll = options.autoScroll || 'true';
|
this.autoScroll = options.autoScroll || true;
|
||||||
} else {
|
} else {
|
||||||
this.autoScroll = options.autoScroll || 'false';
|
this.autoScroll = options.autoScroll || false;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// cursorPos represents zero-based row, col positions
|
// cursorPos represents zero-based row, col positions
|
||||||
|
@ -1012,7 +1011,7 @@ MultiLineEditTextView.prototype.setText = function(text) {
|
||||||
MultiLineEditTextView.prototype.addText = function(text) {
|
MultiLineEditTextView.prototype.addText = function(text) {
|
||||||
this.insertRawText(text);
|
this.insertRawText(text);
|
||||||
|
|
||||||
if(this.autoScroll) {
|
if(this.isEditMode() || this.autoScroll) {
|
||||||
this.cursorEndOfDocument();
|
this.cursorEndOfDocument();
|
||||||
} else {
|
} else {
|
||||||
this.cursorStartOfDocument();
|
this.cursorStartOfDocument();
|
||||||
|
@ -1026,6 +1025,7 @@ MultiLineEditTextView.prototype.getData = function() {
|
||||||
MultiLineEditTextView.prototype.setPropertyValue = function(propName, value) {
|
MultiLineEditTextView.prototype.setPropertyValue = function(propName, value) {
|
||||||
switch(propName) {
|
switch(propName) {
|
||||||
case 'mode' : this.mode = value; break;
|
case 'mode' : this.mode = value; break;
|
||||||
|
case 'autoScroll' : this.autoScroll = value; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiLineEditTextView.super_.prototype.setPropertyValue.call(this, propName, value);
|
MultiLineEditTextView.super_.prototype.setPropertyValue.call(this, propName, value);
|
||||||
|
@ -1075,19 +1075,19 @@ MultiLineEditTextView.prototype.onKeyPress = function(ch, key) {
|
||||||
|
|
||||||
MultiLineEditTextView.prototype.scrollUp = function() {
|
MultiLineEditTextView.prototype.scrollUp = function() {
|
||||||
this.scrollDocumentUp();
|
this.scrollDocumentUp();
|
||||||
}
|
};
|
||||||
|
|
||||||
MultiLineEditTextView.prototype.scrollDown = function() {
|
MultiLineEditTextView.prototype.scrollDown = function() {
|
||||||
this.scrollDocumentDown();
|
this.scrollDocumentDown();
|
||||||
}
|
};
|
||||||
|
|
||||||
MultiLineEditTextView.prototype.deleteLine = function(line) {
|
MultiLineEditTextView.prototype.deleteLine = function(line) {
|
||||||
this.textLines.splice(line, 1);
|
this.textLines.splice(line, 1);
|
||||||
}
|
};
|
||||||
|
|
||||||
MultiLineEditTextView.prototype.getLineCount = function() {
|
MultiLineEditTextView.prototype.getLineCount = function() {
|
||||||
return this.textLines.length;
|
return this.textLines.length;
|
||||||
}
|
};
|
||||||
|
|
||||||
MultiLineEditTextView.prototype.getTextEditMode = function() {
|
MultiLineEditTextView.prototype.getTextEditMode = function() {
|
||||||
return this.overtypeMode ? 'overtype' : 'insert';
|
return this.overtypeMode ? 'overtype' : 'insert';
|
||||||
|
|
Loading…
Reference in New Issue