DBG+GUI: Fully fixing weird logging message display with \n\n prints
This commit is contained in:
parent
6ed1bf2058
commit
d14c990e07
|
@ -11,7 +11,11 @@
|
|||
*/
|
||||
void dputs(const char* Text)
|
||||
{
|
||||
dprintf("%s\n", Text);
|
||||
// Only append the newline if the caller didn't
|
||||
if (Text[strlen(Text) - 1] != '\n')
|
||||
dprintf("%s\n", Text);
|
||||
else
|
||||
dprintf("%s", Text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1974,7 +1974,7 @@ CMDRESULT cbInstrLog(int argc, char* argv[])
|
|||
//log "format {0} string",arg1, arg2, argN
|
||||
if (argc == 1) //just log newline
|
||||
{
|
||||
dprintf("");
|
||||
dprintf("\n");
|
||||
return STATUS_CONTINUE;
|
||||
}
|
||||
FormatValueVector formatArgs;
|
||||
|
|
|
@ -28,7 +28,6 @@ void LogView::addMsgToLogSlot(QString msg)
|
|||
this->insertPlainText(msg);
|
||||
}
|
||||
|
||||
|
||||
void LogView::clearLogSlot()
|
||||
{
|
||||
this->clear();
|
||||
|
|
|
@ -49,14 +49,23 @@ void StatusLabel::debugStateChangedSlot(DBGSTATE state)
|
|||
|
||||
void StatusLabel::logUpdate(QString message)
|
||||
{
|
||||
if(labelText.contains(QChar('\n'))) //newline
|
||||
if (labelText.contains('\n'))
|
||||
labelText = "";
|
||||
labelText += message;
|
||||
//only show the last line in the status label
|
||||
QStringList lineList = labelText.split(QChar('\n'), QString::SkipEmptyParts);
|
||||
if(lineList.size())
|
||||
setText(Qt::convertFromPlainText(lineList[lineList.length() - 1]));
|
||||
|
||||
// Split each newline into a separate string
|
||||
QStringList lineList = message.split('\n', QString::SkipEmptyParts);
|
||||
|
||||
if (lineList.size() > 0)
|
||||
{
|
||||
// Get a substring for the last line only
|
||||
labelText += lineList[lineList.size() - 1] + "\n";
|
||||
}
|
||||
else
|
||||
setText(Qt::convertFromPlainText(labelText));
|
||||
this->repaint();
|
||||
{
|
||||
// Append to the existing message
|
||||
labelText += message;
|
||||
}
|
||||
|
||||
// We want to trim every \n from the visual display
|
||||
setText(Qt::convertFromPlainText(QString(labelText).replace("\n", "")));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue