* Page Up / Page Down for SyncTERM

* Page Down fixes
* Down arrow fixes
This commit is contained in:
Bryan Ashby 2015-06-21 22:36:07 -06:00
parent 45aa97071e
commit 521710e6ec
2 changed files with 11 additions and 8 deletions

View File

@ -263,6 +263,8 @@ function Client(input, output) {
// SyncTERM / EtherTerm
'[K' : { name : 'end' },
'[@' : { name : 'insert' },
'[V' : { name : 'page up' },
'[U' : { name : 'page down' },
// other
'[Z' : { name : 'tab', shift : true },

View File

@ -644,7 +644,10 @@ function MultiLineEditTextView2(options) {
};
this.keyPressDown = function() {
var lastVisibleRow = Math.min(self.dimens.height, self.textLines.length) - 1;
var lastVisibleRow = Math.min(
self.dimens.height,
(self.textLines.length - self.topVisibleIndex)) - 1;
if(self.cursorPos.row < lastVisibleRow) {
self.cursorPos.row++;
self.client.term.write(ansi.down());
@ -659,7 +662,6 @@ function MultiLineEditTextView2(options) {
};
this.keyPressLeft = function() {
console.log(self.cursorPos.col)
if(self.cursorPos.col > 0) {
var prevCharIsTab = self.isTab();
@ -718,12 +720,6 @@ function MultiLineEditTextView2(options) {
};
this.keyPressPageDown = function() {
/*
var linesBelow = self.getRemainingLinesBelowRow();
if(linesBelow > 0) {
self.topVisibleIndex++;
self.redraw();
}*/
var linesBelow = self.getRemainingLinesBelowRow();
if(linesBelow > 0) {
self.topVisibleIndex += Math.min(linesBelow, self.dimens.height);
@ -799,6 +795,11 @@ function MultiLineEditTextView2(options) {
'backspace',
count);
} else {
//
// Delete character at end of line previous.
// * This may be a eol marker
// * Word wrapping will need re-applied
//
// :TODO: apply word wrapping such that text can be re-adjusted if it can now fit on prev
self.keyPressLeft(); // same as hitting left - jump to previous line
}