From 521710e6ecf982e7d4ced5313a432394de1f627a Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 21 Jun 2015 22:36:07 -0600 Subject: [PATCH] * Page Up / Page Down for SyncTERM * Page Down fixes * Down arrow fixes --- core/client.js | 2 ++ core/multi_line_edit_text_view2.js | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/core/client.js b/core/client.js index fe906fbc..1680c27d 100644 --- a/core/client.js +++ b/core/client.js @@ -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 }, diff --git a/core/multi_line_edit_text_view2.js b/core/multi_line_edit_text_view2.js index ace11434..363ab294 100644 --- a/core/multi_line_edit_text_view2.js +++ b/core/multi_line_edit_text_view2.js @@ -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 }