forked from qt-creator/qt-creator
Output panes: Handle the case where an output chunk is split
...right between '\r' and '\n'. Change-Id: Id372cd9a099ef933af4836e20aebc1fc0fd8d5a8 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -62,6 +62,7 @@ public:
|
|||||||
QString settingsKey;
|
QString settingsKey;
|
||||||
|
|
||||||
bool enforceNewline = false;
|
bool enforceNewline = false;
|
||||||
|
bool prependCarriageReturn = false;
|
||||||
bool scrollToBottom = true;
|
bool scrollToBottom = true;
|
||||||
bool linksActive = true;
|
bool linksActive = true;
|
||||||
bool zoomEnabled = false;
|
bool zoomEnabled = false;
|
||||||
@@ -383,7 +384,16 @@ int OutputWindow::maxCharCount() const
|
|||||||
|
|
||||||
void OutputWindow::appendMessage(const QString &output, OutputFormat format)
|
void OutputWindow::appendMessage(const QString &output, OutputFormat format)
|
||||||
{
|
{
|
||||||
QString out = SynchronousProcess::normalizeNewlines(output);
|
QString out = output;
|
||||||
|
if (d->prependCarriageReturn) {
|
||||||
|
d->prependCarriageReturn = false;
|
||||||
|
out.prepend('\r');
|
||||||
|
}
|
||||||
|
out = SynchronousProcess::normalizeNewlines(out);
|
||||||
|
if (out.endsWith('\r')) {
|
||||||
|
d->prependCarriageReturn = true;
|
||||||
|
out.chop(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (out.size() > d->maxCharCount) {
|
if (out.size() > d->maxCharCount) {
|
||||||
// Current line alone exceeds limit, we need to cut it.
|
// Current line alone exceeds limit, we need to cut it.
|
||||||
@@ -497,6 +507,7 @@ bool OutputWindow::isScrollbarAtBottom() const
|
|||||||
void OutputWindow::clear()
|
void OutputWindow::clear()
|
||||||
{
|
{
|
||||||
d->enforceNewline = false;
|
d->enforceNewline = false;
|
||||||
|
d->prependCarriageReturn = false;
|
||||||
QPlainTextEdit::clear();
|
QPlainTextEdit::clear();
|
||||||
if (d->formatter)
|
if (d->formatter)
|
||||||
d->formatter->clear();
|
d->formatter->clear();
|
||||||
|
Reference in New Issue
Block a user