diff options
author | Neil <nyamatongwe@gmail.com> | 2025-02-01 14:43:22 +1100 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2025-02-01 14:43:22 +1100 |
commit | f54fd2019dd648b29a80ec7429833ab546d3a428 (patch) | |
tree | 231bebba7db25fccf798340bdd908f28fd504c26 /src/Editor.cxx | |
parent | db6332fa9933244c45c44063afbdcccb462cfc03 (diff) | |
download | scintilla-mirror-f54fd2019dd648b29a80ec7429833ab546d3a428.tar.gz |
Serialize selection type and ranges with SCI_GETSELECTIONSERIALIZED and
SCI_SETSELECTIONSERIALIZED.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index 10c694990..d85a4c294 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -711,6 +711,15 @@ void Editor::SetEmptySelection(Sci::Position currentPos_) { SetEmptySelection(SelectionPosition(currentPos_)); } +void Editor::SetSelectionFromSerialized(const char *serialized) { + if (serialized) { + sel = Selection(serialized); + sel.Truncate(pdoc->Length()); + SetRectangularRange(); + InvalidateStyleRedraw(); + } +} + void Editor::MultipleSelectAdd(AddNumber addNumber) { if (SelectionEmpty() || !multipleSelection) { // Select word at caret @@ -8695,6 +8704,15 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { case Message::GetUndoSelectionHistory: return static_cast<sptr_t>(undoSelectionHistoryOption); + case Message::SetSelectionSerialized: + SetSelectionFromSerialized(ConstCharPtrFromSPtr(lParam)); + break; + + case Message::GetSelectionSerialized: { + const std::string serialized = sel.ToString(); + return BytesResult(lParam, serialized); + } + case Message::SetExtraAscent: vs.extraAscent = static_cast<int>(wParam); InvalidateStyleRedraw(); |