aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/window_text_buffer.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2018-12-28 21:15:50 -0800
committerPaul Gilbert2018-12-28 21:15:50 -0800
commit7a21e236035876c8ae581d4f9d61584c6385b89a (patch)
tree64adffd16ae97d040f73bdf688726f0dc48c0676 /engines/glk/window_text_buffer.cpp
parentf218400d3b75ee1cf537e2ca9db23bc417475c10 (diff)
downloadscummvm-rg350-7a21e236035876c8ae581d4f9d61584c6385b89a.tar.gz
scummvm-rg350-7a21e236035876c8ae581d4f9d61584c6385b89a.tar.bz2
scummvm-rg350-7a21e236035876c8ae581d4f9d61584c6385b89a.zip
GLK: FROTZ: Implement PageUp/PageDn scrolling of desc area in Beyond Zork
Diffstat (limited to 'engines/glk/window_text_buffer.cpp')
-rw-r--r--engines/glk/window_text_buffer.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/engines/glk/window_text_buffer.cpp b/engines/glk/window_text_buffer.cpp
index 6069ec8a82..6e48d1ddc4 100644
--- a/engines/glk/window_text_buffer.cpp
+++ b/engines/glk/window_text_buffer.cpp
@@ -762,9 +762,10 @@ void TextBufferWindow::cancelLineEvent(Event *ev) {
_lineRequest = false;
_lineRequestUni = false;
if (_lineTerminators) {
- free(_lineTerminators);
+ delete[] _lineTerminators;
_lineTerminators = nullptr;
}
+
_inBuf = nullptr;
_inMax = 0;
@@ -1246,15 +1247,10 @@ void TextBufferWindow::acceptReadLine(uint32 arg) {
if (_height < 2)
_scrollPos = 0;
- if (_scrollPos || arg == keycode_PageUp || arg == keycode_MouseWheelUp) {
- acceptScroll(arg);
- return;
- }
-
if (!_inBuf)
return;
- if (_lineTerminators && checkTerminator(arg)) {
+ if (_lineTerminators && checkTerminators(arg)) {
for (cx = _lineTerminators; *cx; cx++) {
if (*cx == arg) {
acceptLine(arg);
@@ -1263,6 +1259,11 @@ void TextBufferWindow::acceptReadLine(uint32 arg) {
}
}
+ if (_scrollPos || arg == keycode_PageUp || arg == keycode_MouseWheelUp) {
+ acceptScroll(arg);
+ return;
+ }
+
switch (arg) {
// History keys (up and down)
case keycode_Up:
@@ -1442,10 +1443,16 @@ void TextBufferWindow::acceptLine(uint32 keycode) {
_attr = _origAttr;
if (_lineTerminators) {
- uint val2 = keycode;
- if (val2 == keycode_Return)
- val2 = 0;
- g_vm->_events->store(evtype_LineInput, this, len, val2);
+ if (keycode == keycode_Return)
+ keycode = 0;
+ else
+ // TODO: Currently particularly for Beyond Zork, we don't echo a newline
+ // for line terminators, allowing description area scrolling to not keep adding
+ // blank lines in the command area. In the future I may need to make it configurable
+ // when I see if any other line terminators need to have a newline
+ _echoLineInput = false;
+
+ g_vm->_events->store(evtype_LineInput, this, len, keycode);
free(_lineTerminators);
_lineTerminators = nullptr;
} else {