Modified behavior when pressing backspace on a line which has an error marker: the marker is moved to the previous line now.
diff --git a/TextEditor.cpp b/TextEditor.cpp
index 8bb433e..985e802 100644
--- a/TextEditor.cpp
+++ b/TextEditor.cpp
@@ -373,7 +373,7 @@
for (auto& i : mErrorMarkers)
{
ErrorMarkers::value_type e(i.first > aIndex ? i.first - 1 : i.first, i.second);
- if (e.first == aIndex)
+ if (e.first - 1 == aIndex)
continue;
etmp.insert(e);
}
@@ -1299,7 +1299,6 @@
if (mLines.empty())
return;
-
UndoRecord u;
u.mBefore = mState;
@@ -1329,6 +1328,12 @@
auto& prevLine = mLines[mState.mCursorPosition.mLine - 1];
auto prevSize = (int)prevLine.size();
prevLine.insert(prevLine.end(), line.begin(), line.end());
+
+ ErrorMarkers etmp;
+ for (auto& i : mErrorMarkers)
+ etmp.insert(ErrorMarkers::value_type(i.first - 1 == mState.mCursorPosition.mLine ? i.first - 1 : i.first, i.second));
+ mErrorMarkers = std::move(etmp);
+
RemoveLine(mState.mCursorPosition.mLine);
--mState.mCursorPosition.mLine;
mState.mCursorPosition.mColumn = prevSize;