diff options
| author | Neil <nyamatongwe@gmail.com> | 2026-04-23 10:42:27 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2026-04-23 10:42:27 +1000 |
| commit | fc5004a9e14cfd5c462abca0c8af3cab614aa48d (patch) | |
| tree | 3ee485eec59e9f1547002a8b862c3d25b2a7e306 /src/Editor.cxx | |
| parent | ff16983250f077aa2fa1ac1039ad421813fd20f0 (diff) | |
| download | scintilla-mirror-fc5004a9e14cfd5c462abca0c8af3cab614aa48d.tar.gz | |
Add error status SC_STATUS_OUTSIDE_DOCUMENT that is set when operations are
attempted on a position outside the document.
Positions are checked earlier to prevent actions partly succeeding.
This is implemented with a new exception type Failure which should be caught by
platform layer's API handling code to produce a more granular error status.
Diffstat (limited to 'src/Editor.cxx')
| -rw-r--r-- | src/Editor.cxx | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index d946c7bd2..1dfa8fd6b 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -5899,6 +5899,8 @@ Sci::Position Editor::GetTag(char *tagValue, int tagNumber) { } Sci::Position Editor::ReplaceTarget(ReplaceType replaceType, std::string_view text) { + pdoc->CheckPosition(targetRange.start.Position()); + UndoGroup ug(pdoc); std::string substituted; // Copy in case of re-entrance @@ -6697,6 +6699,7 @@ sptr_t Editor::WndProc(Message iMessage, uptr_t wParam, sptr_t lParam) { Sci::Position insertPos = PositionFromUPtr(wParam); if (insertPos == -1) insertPos = CurrentPosition(); + pdoc->CheckPosition(insertPos); Sci::Position newCurrent = CurrentPosition(); const char *sz = ConstCharPtrFromSPtr(lParam); const Sci::Position lengthInserted = pdoc->InsertString(insertPos, sz, strlen(sz)); |
