Skip to content

Commit 2b63751

Browse files
committedAug 21, 2019
Keep last line of terminal text visible when cursor is at the end of text.
Signed-off-by: Pavel Pisa <[email protected]>
1 parent 975cb34 commit 2b63751

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎qtmips_gui/terminaldock.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,16 @@ void TerminalDock::setup(machine::SerialPort *ser_port) {
7575
}
7676

7777
void TerminalDock::tx_byte(unsigned int data) {
78+
bool at_end = terminal_text->textCursor().atEnd();
7879
if (data == '\n')
7980
append_cursor->insertBlock();
8081
else
8182
append_cursor->insertText(QString(QChar(data)));
83+
if (at_end) {
84+
QTextCursor cursor = QTextCursor(terminal_text->document());
85+
cursor.movePosition(QTextCursor::End);
86+
terminal_text->setTextCursor(cursor);
87+
}
8288
}
8389

8490
void TerminalDock::tx_byte(int fd, unsigned int data)

0 commit comments

Comments
 (0)
Please sign in to comment.