aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2022-11-22 09:24:07 +1100
committerNeil <nyamatongwe@gmail.com>2022-11-22 09:24:07 +1100
commitcb8cd73d839a96f98bb1ce887c694271f9c24788 (patch)
tree1920fae848da38e7942ea9a36c21f87272254e23 /src/Document.cxx
parentb3e46461ce564d295b629a1d16dc4cee60722e66 (diff)
downloadscintilla-mirror-cb8cd73d839a96f98bb1ce887c694271f9c24788.tar.gz
Add SCI_REPLACETARGETMINIMAL to change text without causing unchanged prefix and
suffix to be marked as modified in change history.
Diffstat (limited to 'src/Document.cxx')
-rw-r--r--src/Document.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 0237cef78..6a638471d 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -1242,6 +1242,17 @@ void Document::CheckReadOnly() {
}
}
+void Document::TrimReplacement(std::string_view &text, Range &range) const noexcept {
+ while (!text.empty() && !range.Empty() && (text.front() == CharAt(range.start))) {
+ text.remove_prefix(1);
+ range.start++;
+ }
+ while (!text.empty() && !range.Empty() && (text.back() == CharAt(range.end-1))) {
+ text.remove_suffix(1);
+ range.end--;
+ }
+}
+
// Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt.
// SetStyleAt does not change the persistent state of a document