aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
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