Skip to content

Commit dcd7a8c

Browse files
committed
qt: don't clear console prompt when resizing
On master, a console resize event will clear the prompt. To fix this, we store the content of the prompt and re-set it upon a resize.
1 parent 590e49c commit dcd7a8c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/qt/rpcconsole.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -764,11 +764,12 @@ void RPCConsole::setFontSize(int newSize)
764764
if (newSize < FONT_RANGE.width() || newSize > FONT_RANGE.height())
765765
return;
766766

767-
// temp. store the console content
768-
QString str = ui->messagesWidget->toHtml();
767+
// temp. store the console and prompt content
768+
QString strConsole = ui->messagesWidget->toHtml();
769+
QString strPrompt = ui->lineEdit->text();
769770

770771
// replace font tags size in current content
771-
str.replace(QString("font-size:%1pt").arg(consoleFontSize), QString("font-size:%1pt").arg(newSize));
772+
strConsole.replace(QString("font-size:%1pt").arg(consoleFontSize), QString("font-size:%1pt").arg(newSize));
772773

773774
// store the new font size
774775
consoleFontSize = newSize;
@@ -777,8 +778,9 @@ void RPCConsole::setFontSize(int newSize)
777778
// clear console (reset icon sizes, default stylesheet) and re-add the content
778779
float oldPosFactor = 1.0 / ui->messagesWidget->verticalScrollBar()->maximum() * ui->messagesWidget->verticalScrollBar()->value();
779780
clear(false);
780-
ui->messagesWidget->setHtml(str);
781+
ui->messagesWidget->setHtml(strConsole);
781782
ui->messagesWidget->verticalScrollBar()->setValue(oldPosFactor * ui->messagesWidget->verticalScrollBar()->maximum());
783+
ui->lineEdit->setText(strPrompt);
782784
}
783785

784786
void RPCConsole::clear(bool clearHistory)

0 commit comments

Comments
 (0)