diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2020-09-09 23:41:24 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2020-09-09 23:41:24 -0400 |
commit | 9ec5dc184d3095ea6c091ecd326e459c7caf2ca7 (patch) | |
tree | 5b0f8425f7aad7fe1d434812fe24be656d0cafce /src/Editor.cxx | |
parent | a0b3f49afb6107c33582dc2c1fcace558c0d1f2c (diff) | |
download | scintilla-mirror-9ec5dc184d3095ea6c091ecd326e459c7caf2ca7.tar.gz |
Backport: Feature [feature-requests:1350]. Add SCI_GETMULTIEDGECOLUMN.
Backport of changeset 8507:e72e8cf58ea7.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 4256bb817..8453118b3 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7690,16 +7690,33 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { InvalidateStyleRedraw(); break; - case SCI_MULTIEDGEADDLINE: - vs.theMultiEdge.push_back(EdgeProperties(wParam, lParam)); - InvalidateStyleRedraw(); - break; + case SCI_MULTIEDGEADDLINE: { + // Insert new edge in sorted order. + const int column = static_cast<int>(wParam); + vs.theMultiEdge.insert( + std::upper_bound(vs.theMultiEdge.begin(), vs.theMultiEdge.end(), column, + [](const EdgeProperties &a, const EdgeProperties &b) { + return a.column < b.column; + }), + EdgeProperties(wParam, lParam)); + InvalidateStyleRedraw(); + break; + } case SCI_MULTIEDGECLEARALL: std::vector<EdgeProperties>().swap(vs.theMultiEdge); // Free vector and memory, C++03 compatible InvalidateStyleRedraw(); break; + case SCI_GETMULTIEDGECOLUMN: { + const size_t which = wParam; + // size_t is unsigned so this also handles negative inputs. + if (which >= vs.theMultiEdge.size()) { + return -1; + } + return vs.theMultiEdge[which].column; + } + case SCI_GETACCESSIBILITY: return SC_ACCESSIBILITY_DISABLED; |