diff --git a/CHANGELOG.md b/CHANGELOG.md index e34b497..a2a64f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,8 @@ * Fixed regression when adding commands to a breakpoint. * Refactored/improved Printpoints. Added 'help' to the Printpoint create dialog. +* Fixed regression when display variable value when hovering over + the text in the editor window. ## [2.4] - 2024-03-18 * Changed main icon to a more license friendly one. diff --git a/src/SeerEditorWidgetSource.h b/src/SeerEditorWidgetSource.h index 4e1fae5..ef6d015 100644 --- a/src/SeerEditorWidgetSource.h +++ b/src/SeerEditorWidgetSource.h @@ -132,6 +132,8 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit { void contextMenuEvent (QContextMenuEvent* event); void mouseReleaseEvent (QMouseEvent* event); bool event (QEvent* event); + void showExpressionTooltip (); + void hideExpressionTooltip (); private slots: void refreshExtraSelections (); diff --git a/src/SeerEditorWidgetSourceAreas.cpp b/src/SeerEditorWidgetSourceAreas.cpp index 994d743..89c5d97 100644 --- a/src/SeerEditorWidgetSourceAreas.cpp +++ b/src/SeerEditorWidgetSourceAreas.cpp @@ -509,14 +509,7 @@ bool SeerEditorWidgetSourceArea::event(QEvent* event) { QString word = cursor.selectedText(); if (word.isEmpty() == true) { - - QToolTip::hideText(); - - _selectedExpressionCursor = QTextCursor(); - _selectedExpressionPosition = QPoint(); - _selectedExpressionName = ""; - _selectedExpressionValue = ""; - + hideExpressionTooltip(); break; } @@ -526,19 +519,30 @@ bool SeerEditorWidgetSourceArea::event(QEvent* event) { // Same word as before? Display the tooltip value. if (word == _selectedExpressionName) { - QToolTip::showText(helpEvent->globalPos(), _selectedExpressionName + ": " + Seer::elideText(_selectedExpressionValue, Qt::ElideRight, 100)); + // If the tooltip is already visible, refreshen it with + // the same value, possibly at a new postion. + if (QToolTip::isVisible()) { + _selectedExpressionPosition = helpEvent->globalPos(); + + showExpressionTooltip(); + + // If not already visible, refreshen its value. + }else{ + emit evaluateVariableExpression(_selectedExpressionId, _selectedExpressionName); // For the tooltip. + } // Otherwise, hide any old one. }else{ - QToolTip::hideText(); + hideExpressionTooltip(); } // Otherwise it's a different spot. Create a new request to get the variable's value. }else{ - QToolTip::hideText(); + + hideExpressionTooltip(); _selectedExpressionCursor = cursor; - _selectedExpressionPosition = helpEvent->pos(); + _selectedExpressionPosition = helpEvent->globalPos(); _selectedExpressionName = word; _selectedExpressionValue = ""; @@ -555,6 +559,24 @@ bool SeerEditorWidgetSourceArea::event(QEvent* event) { return QPlainTextEdit::event(event); } +void SeerEditorWidgetSourceArea::showExpressionTooltip () { + + // qDebug() << "Tooltip:" << _selectedExpressionPosition << _selectedExpressionName << _selectedExpressionValue; + + QToolTip::hideText(); + QToolTip::showText(_selectedExpressionPosition, _selectedExpressionName + ": " + Seer::elideText(_selectedExpressionValue, Qt::ElideRight, 100)); +} + +void SeerEditorWidgetSourceArea::hideExpressionTooltip () { + + QToolTip::hideText(); + + _selectedExpressionCursor = QTextCursor(); + _selectedExpressionPosition = QPoint(); + _selectedExpressionName = ""; + _selectedExpressionValue = ""; +} + void SeerEditorWidgetSourceArea::refreshExtraSelections () { // @@ -1744,6 +1766,8 @@ void SeerEditorWidgetSourceArea::handleText (const QString& text) { if (id_text.toInt() == _selectedExpressionId) { _selectedExpressionValue = Seer::filterEscapes(Seer::parseFirst(text, "value=", '"', '"', false)); + + showExpressionTooltip(); } return; diff --git a/src/SeerMainWindow.cpp b/src/SeerMainWindow.cpp index deb3b78..6bf33ae 100644 --- a/src/SeerMainWindow.cpp +++ b/src/SeerMainWindow.cpp @@ -885,6 +885,26 @@ void SeerMainWindow::handleText (const QString& text) { return; } + if (msg_text.startsWith("\"A syntax error in expression, near")) { + return; + } + + if (msg_text.startsWith("\"Invalid character ")) { + return; + } + + if (msg_text.startsWith("\"No symbol ")) { + return; + } + + if (msg_text.startsWith("\"Problem parsing arguments: data-evaluate-expression")) { + return; + } + + if (msg_text == "\"Attempt to use a type name as an expression\"") { + return; + } + gdbWidget->addMessage(Seer::filterEscapes(msg_text), QMessageBox::Warning); return;