Erase color of level 0 bt line when target is running

This commit is contained in:
QuangNguyenMinh123
2025-12-12 14:44:38 +07:00
parent bcce57ea70
commit 7d96a8905e
4 changed files with 45 additions and 2 deletions
+17 -2
View File
@@ -631,7 +631,7 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
// Parse through the frame list and set the current lines that are in the frame list.
QStringList frame_list = Seer::parse(newtext, "frame=", '{', '}', false);
_lastFrameList = frame_list;
SeerEditorManagerEntries::iterator i_later=endEntry();
int lineToPrintLater = -1;
for ( const auto& frame_text : frame_list ) {
@@ -732,7 +732,22 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
static_cast<SeerEditorWidgetSource*>(w)->sourceArea()->handleText(text);
}
}else{
}else if (text.startsWith("*running")) {
// target / program is running, should erase 'yellow' color is for the current line
// _lastFrameList is invoked to erase previously "colored" line
for ( const auto& frame_text : _lastFrameList ) {
QString fullname_text = Seer::parseFirst(frame_text, "fullname=", '"', '"', false);
QString line_text = Seer::parseFirst(frame_text, "line=", '"', '"', false);
SeerEditorManagerEntries::iterator i = findEntry(fullname_text);
SeerEditorManagerEntries::iterator e = endEntry();
if (i != e) {
i->widget->sourceArea()->eraseColorCurrentLine(line_text.toInt());
}
}
}
else{
// Ignore others.
return;
}
+1
View File
@@ -155,5 +155,6 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW
bool _showOpcodeColumn;
bool _showSourceLines;
bool _notifyAssemblyTabShown;
QStringList _lastFrameList; // variable for saving previous backtrace
};
+1
View File
@@ -97,6 +97,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit {
void setExternalEditorCommand (const QString& externalEditorCommand);
const QString& externalEditorCommand ();
void eraseColorCurrentLine (int lineno);
signals:
void insertBreakpoint (QString breakpoint);
void insertPrintpoint (QString type, QString function, QString channel, QString parameters);
+26
View File
@@ -1669,6 +1669,32 @@ const QString& SeerEditorWidgetSourceArea::externalEditorCommand () {
return _externalEditorCommand;
}
void SeerEditorWidgetSourceArea::eraseColorCurrentLine (int lineno) {
// Erase color of this line
QTextCharFormat lineFormat;
lineFormat = highlighterSettings().get("Text");
// Create a selection at the cursor.
QTextBlock block = document()->findBlockByLineNumber(lineno-1);
QTextCursor cursor = textCursor();
cursor.setPosition(block.position());
QTextEdit::ExtraSelection selection;
selection.format.setForeground(lineFormat.foreground());
selection.format.setBackground(lineFormat.background());
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
selection.cursor = cursor;
selection.cursor.clearSelection();
// Add it to the extra selection list.
_currentLinesExtraSelections.append(selection);
// Refresh all the extra selections.
refreshExtraSelections();
}
void SeerEditorWidgetSourceArea::handleText (const QString& text) {
if (text.startsWith("*stopped")) {