1
0
Fork 0

DBG+GUI: Fully fixing weird logging message display with \n\n prints

This commit is contained in:
Nukem 2015-11-26 20:04:31 -05:00
parent 6ed1bf2058
commit d14c990e07
4 changed files with 23 additions and 11 deletions

View File

@ -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);
}
/**

View File

@ -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;

View File

@ -28,7 +28,6 @@ void LogView::addMsgToLogSlot(QString msg)
this->insertPlainText(msg);
}
void LogView::clearLogSlot()
{
this->clear();

View File

@ -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", "")));
}