Skip to content

Commit 7d96a89

Browse files
Erase color of level 0 bt line when target is running
1 parent bcce57e commit 7d96a89

File tree

4 files changed

+45
-2
lines changed

4 files changed

+45
-2
lines changed

src/SeerEditorManagerWidget.cpp

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
631631

632632
// Parse through the frame list and set the current lines that are in the frame list.
633633
QStringList frame_list = Seer::parse(newtext, "frame=", '{', '}', false);
634-
634+
_lastFrameList = frame_list;
635635
SeerEditorManagerEntries::iterator i_later=endEntry();
636636
int lineToPrintLater = -1;
637637
for ( const auto& frame_text : frame_list ) {
@@ -732,7 +732,22 @@ void SeerEditorManagerWidget::handleText (const QString& text) {
732732
static_cast<SeerEditorWidgetSource*>(w)->sourceArea()->handleText(text);
733733
}
734734

735-
}else{
735+
}else if (text.startsWith("*running")) {
736+
// target / program is running, should erase 'yellow' color is for the current line
737+
// _lastFrameList is invoked to erase previously "colored" line
738+
for ( const auto& frame_text : _lastFrameList ) {
739+
QString fullname_text = Seer::parseFirst(frame_text, "fullname=", '"', '"', false);
740+
QString line_text = Seer::parseFirst(frame_text, "line=", '"', '"', false);
741+
742+
SeerEditorManagerEntries::iterator i = findEntry(fullname_text);
743+
SeerEditorManagerEntries::iterator e = endEntry();
744+
745+
if (i != e) {
746+
i->widget->sourceArea()->eraseColorCurrentLine(line_text.toInt());
747+
}
748+
}
749+
}
750+
else{
736751
// Ignore others.
737752
return;
738753
}

src/SeerEditorManagerWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,6 @@ class SeerEditorManagerWidget : public QWidget, protected Ui::SeerEditorManagerW
155155
bool _showOpcodeColumn;
156156
bool _showSourceLines;
157157
bool _notifyAssemblyTabShown;
158+
QStringList _lastFrameList; // variable for saving previous backtrace
158159
};
159160

src/SeerEditorWidgetSource.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class SeerEditorWidgetSourceArea : public SeerPlainTextEdit {
9797
void setExternalEditorCommand (const QString& externalEditorCommand);
9898
const QString& externalEditorCommand ();
9999

100+
void eraseColorCurrentLine (int lineno);
100101
signals:
101102
void insertBreakpoint (QString breakpoint);
102103
void insertPrintpoint (QString type, QString function, QString channel, QString parameters);

src/SeerEditorWidgetSourceAreas.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,6 +1669,32 @@ const QString& SeerEditorWidgetSourceArea::externalEditorCommand () {
16691669
return _externalEditorCommand;
16701670
}
16711671

1672+
void SeerEditorWidgetSourceArea::eraseColorCurrentLine (int lineno) {
1673+
1674+
// Erase color of this line
1675+
QTextCharFormat lineFormat;
1676+
lineFormat = highlighterSettings().get("Text");
1677+
1678+
// Create a selection at the cursor.
1679+
QTextBlock block = document()->findBlockByLineNumber(lineno-1);
1680+
QTextCursor cursor = textCursor();
1681+
1682+
cursor.setPosition(block.position());
1683+
1684+
QTextEdit::ExtraSelection selection;
1685+
selection.format.setForeground(lineFormat.foreground());
1686+
selection.format.setBackground(lineFormat.background());
1687+
selection.format.setProperty(QTextFormat::FullWidthSelection, true);
1688+
selection.cursor = cursor;
1689+
selection.cursor.clearSelection();
1690+
1691+
// Add it to the extra selection list.
1692+
_currentLinesExtraSelections.append(selection);
1693+
1694+
// Refresh all the extra selections.
1695+
refreshExtraSelections();
1696+
}
1697+
16721698
void SeerEditorWidgetSourceArea::handleText (const QString& text) {
16731699

16741700
if (text.startsWith("*stopped")) {

0 commit comments

Comments
 (0)