From 7a21e236035876c8ae581d4f9d61584c6385b89a Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 28 Dec 2018 21:15:50 -0800 Subject: GLK: FROTZ: Implement PageUp/PageDn scrolling of desc area in Beyond Zork --- engines/glk/window_text_buffer.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'engines/glk/window_text_buffer.cpp') 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 { -- cgit v1.2.3