diff options
author | Derek Brown <unknown> | 2020-08-25 09:25:01 +1000 |
---|---|---|
committer | Derek Brown <unknown> | 2020-08-25 09:25:01 +1000 |
commit | 2117f9e7b583e9093b6b297f8782027098320496 (patch) | |
tree | c2620d71f81ebe7ace1007a7f78c8b1d28594cac /src | |
parent | 60504a3b1ab9c4777bfc3620538212d6ac5423af (diff) | |
download | scintilla-mirror-2117f9e7b583e9093b6b297f8782027098320496.tar.gz |
Feature [feature-requests:1350]. Add SCI_GETMULTIEDGECOLUMN.
Diffstat (limited to 'src')
-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 5e9c0b673..cfd9e150e 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7704,16 +7704,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; |