diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-08-21 08:45:33 +0200 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-08-21 08:45:33 +0200 |
commit | 2b637518403bfbec4a6823dccc09a9301751302e (patch) | |
tree | 86de3213f7758ff32ec0410258c7aacb48f805bd /qtmips_gui | |
parent | 975cb348c513ad77014a9b22628adbe06157b1fb (diff) | |
download | qtmips-2b637518403bfbec4a6823dccc09a9301751302e.tar.gz qtmips-2b637518403bfbec4a6823dccc09a9301751302e.tar.bz2 qtmips-2b637518403bfbec4a6823dccc09a9301751302e.zip |
Keep last line of terminal text visible when cursor is at the end of text.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/terminaldock.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/qtmips_gui/terminaldock.cpp b/qtmips_gui/terminaldock.cpp index 60271f9..8ae419a 100644 --- a/qtmips_gui/terminaldock.cpp +++ b/qtmips_gui/terminaldock.cpp @@ -75,10 +75,16 @@ void TerminalDock::setup(machine::SerialPort *ser_port) { } void TerminalDock::tx_byte(unsigned int data) { + bool at_end = terminal_text->textCursor().atEnd(); if (data == '\n') append_cursor->insertBlock(); else append_cursor->insertText(QString(QChar(data))); + if (at_end) { + QTextCursor cursor = QTextCursor(terminal_text->document()); + cursor.movePosition(QTextCursor::End); + terminal_text->setTextCursor(cursor); + } } void TerminalDock::tx_byte(int fd, unsigned int data) |