diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c2ad02..f866e97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ * Prepare for the 2.4 release cycle. * Fixed string compares for breakpoint conditions (#184) * Added '--bs' command line option to specify a breakpoint at a source.cpp:lineno +* Fixed long tooltips text by restricting them to 100 characters. (#189) + The text in the various viewing dialogs is still the full length. + The 100 limit probably needs to be configurable. ## [2.3] - 2023-11-19 * In the margins of the source windows, allow CTRL+DoubleClick to do a quick RunToLine or RunToAddress. diff --git a/src/SeerEditorWidgetSourceAreas.cpp b/src/SeerEditorWidgetSourceAreas.cpp index 60d67f7..1b86fb3 100644 --- a/src/SeerEditorWidgetSourceAreas.cpp +++ b/src/SeerEditorWidgetSourceAreas.cpp @@ -523,7 +523,7 @@ bool SeerEditorWidgetSourceArea::event(QEvent* event) { // Same word as before? Display the tooltip value. if (word == _selectedExpressionName) { - QToolTip::showText(helpEvent->globalPos(), _selectedExpressionName + ": " + _selectedExpressionValue); + QToolTip::showText(helpEvent->globalPos(), _selectedExpressionName + ": " + Seer::elideText(_selectedExpressionValue, Qt::ElideRight, 100)); // Otherwise, hide any old one. }else{ diff --git a/src/SeerStackArgumentsBrowserWidget.cpp b/src/SeerStackArgumentsBrowserWidget.cpp index 0e0ba32..0bd4091 100644 --- a/src/SeerStackArgumentsBrowserWidget.cpp +++ b/src/SeerStackArgumentsBrowserWidget.cpp @@ -521,7 +521,7 @@ void SeerStackArgumentsBrowserWidget::handleItemEntered (QTreeWidgetItem* item, }else{ QTreeWidgetItem* parent = item->parent(); // Get parent item, which is the level. - item->setToolTip(0, parent->text(0) + " : " + item->text(1) + " : " + item->text(2)); + item->setToolTip(0, parent->text(0) + " : " + item->text(1) + " : " + Seer::elideText(item->text(2), Qt::ElideRight, 100)); for (int i=1; icolumnCount(); i++) { // Copy tooltip to the other columns. item->setToolTip(i, item->toolTip(0)); diff --git a/src/SeerStackLocalsBrowserWidget.cpp b/src/SeerStackLocalsBrowserWidget.cpp index 1a73a63..43d0ef5 100644 --- a/src/SeerStackLocalsBrowserWidget.cpp +++ b/src/SeerStackLocalsBrowserWidget.cpp @@ -482,7 +482,7 @@ void SeerStackLocalsBrowserWidget::handleItemEntered (QTreeWidgetItem* item, int //qDebug() << item->text(0) << column; - item->setToolTip(0, item->text(0) + " : " + item->text(2)); + item->setToolTip(0, item->text(0) + " : " + Seer::elideText(item->text(2), Qt::ElideRight, 100)); for (int i=1; icolumnCount(); i++) { // Copy tooltip to the other columns. item->setToolTip(i, item->toolTip(0)); diff --git a/src/SeerUtl.cpp b/src/SeerUtl.cpp index 04993e8..8855509 100644 --- a/src/SeerUtl.cpp +++ b/src/SeerUtl.cpp @@ -17,32 +17,39 @@ namespace Seer { return SEER_VERSION + QString(" (Qt") + QT_VERSION_STR + ")"; } - QString filterEscapes (const QString& str, bool handleCR) { + QString filterEscapes (const QString& str) { - QString tmp = str; + // Remove one level of '\'. + // value="\"'Treasure' by Lucillius\\n\\n\\tbut theirs.\\n\"" - tmp.replace("\\r", "\r"); - tmp.replace("\\t", "\t"); - tmp.replace("\\\"", "\""); + QString tmp; + bool escaped = false; - if (handleCR) { - tmp.replace("\\n", "\n"); + for (int i=0; i #include #include +#include namespace Seer { QString version (); - QString filterEscapes (const QString& str, bool handleCR = true); - QStringList filterEscapes (const QStringList& strings, bool handleCR = true); + QString filterEscapes (const QString& str); + QStringList filterEscapes (const QStringList& strings); QString expandTabs (const QString& str, int tabwidth, bool morph); QString expandEnv (const QString& str, bool* ok = nullptr); QStringList parse (const QString& str, const QString& search, QChar startBracket, QChar endBracket, bool includeSearch); @@ -26,6 +27,7 @@ namespace Seer { QStringList quoteChars (const QStringList& strings, const QString& chars); QString varObjParent (const QString& str); bool matchesWildcard (const QStringList& regexpatterns, const QString& string); + QString elideText (const QString& str, Qt::TextElideMode mode, int length); int createID (); diff --git a/src/SeerVariableLoggerBrowserWidget.cpp b/src/SeerVariableLoggerBrowserWidget.cpp index ed133de..932d740 100644 --- a/src/SeerVariableLoggerBrowserWidget.cpp +++ b/src/SeerVariableLoggerBrowserWidget.cpp @@ -47,8 +47,6 @@ void SeerVariableLoggerBrowserWidget::handleText (const QString& text) { if (text.contains(QRegularExpression("^([0-9]+)\\^done,value="))) { - //qDebug() << text; - // "6^done,value=\"\\\"abc\\\"\"" QString id_text = text.section('^', 0,0); @@ -226,7 +224,7 @@ void SeerVariableLoggerBrowserWidget::handleItemEntered (QTreeWidgetItem* item, //qDebug() << item->text(3) << column; - item->setToolTip(0, item->text(0) + " : " + item->text(1) + " : " + item->text(2)); + item->setToolTip(0, item->text(0) + " : " + item->text(1) + " : " + Seer::elideText(item->text(2), Qt::ElideRight, 100)); for (int i=1; icolumnCount(); i++) { // Copy tooltip to other columns. item->setToolTip(i, item->toolTip(0)); diff --git a/src/SeerVariableTrackerBrowserWidget.cpp b/src/SeerVariableTrackerBrowserWidget.cpp index f7cac69..64fa53b 100644 --- a/src/SeerVariableTrackerBrowserWidget.cpp +++ b/src/SeerVariableTrackerBrowserWidget.cpp @@ -293,7 +293,7 @@ void SeerVariableTrackerBrowserWidget::handleItemEntered (QTreeWidgetItem* item, Q_UNUSED(column); - item->setToolTip(0, item->text(0) + " : " + item->text(1)); + item->setToolTip(0, item->text(0) + " : " + Seer::elideText(item->text(1), Qt::ElideRight, 100)); for (int i=1; icolumnCount(); i++) { // Copy tooltip to other columns. item->setToolTip(i, item->toolTip(0));