fix textarea cursor position.
This commit is contained in:
parent
0db80e844b
commit
31a0a0a2e6
|
@ -2558,15 +2558,22 @@ Textarea.prototype.__proto__ = ScrollableText.prototype;
|
|||
|
||||
Textarea.prototype.type = 'textarea';
|
||||
|
||||
// TODO: Optimize this. Remember cursor coords.
|
||||
// Optimize to use CUU, CUD, CUB, CUF.
|
||||
Textarea.prototype.updateCursor = function() {
|
||||
if (this.screen.focused !== this) return;
|
||||
|
||||
var _clines = this.value.split('\n');
|
||||
var clen = _clines.length;
|
||||
var last = _clines[_clines.length-1];
|
||||
var last = this._clines[this._clines.length-1];
|
||||
|
||||
// Stop a situation where the textarea begins scrolling
|
||||
// and the last cline appears to always be empty from the
|
||||
// _typeScroll `+ '\n'` thing.
|
||||
if (last === '' && this.value[this.value.length-1] !== '\n') {
|
||||
last = this._clines[this._clines.length-2] || '';
|
||||
}
|
||||
|
||||
var line = Math.min(
|
||||
clen - 1 - this.childBase,
|
||||
this._clines.length - 1 - this.childBase,
|
||||
this.height - (this.border ? 2 : 0) - 1);
|
||||
|
||||
this.screen.program.cup(
|
||||
|
|
Loading…
Reference in New Issue