aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVivian De Smedt <vivian@vdesmedt.com>2013-01-08 10:16:10 +0100
committerVivian De Smedt <vivian@vdesmedt.com>2013-01-08 10:16:10 +0100
commit499359e6090a0e60c2f59e4eab4ee027506a13be (patch)
tree514e6d0e5e98eabad3d4a282a29b970ac0d69d6b
parent3b3834974339ea1363da2aaf34ef2f4162616949 (diff)
downloadscintilla-mirror-499359e6090a0e60c2f59e4eab4ee027506a13be.tar.gz
Bug: [#1289]. Replace null characters by spaces in the clipboard to avoid that
its content is truncated in the paste operation.
-rw-r--r--src/Editor.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Editor.h b/src/Editor.h
index e040bdb47..5a32b5aad 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -95,6 +95,7 @@ public:
characterSet = characterSet_;
rectangular = rectangular_;
lineCopy = lineCopy_;
+ FixSelectionForClipboard();
}
void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
delete []s;
@@ -108,10 +109,22 @@ public:
characterSet = characterSet_;
rectangular = rectangular_;
lineCopy = lineCopy_;
+ FixSelectionForClipboard();
}
void Copy(const SelectionText &other) {
Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular, other.lineCopy);
}
+
+private:
+ void FixSelectionForClipboard() {
+ // Replace null characters by spaces.
+ // To avoid that the content of the clipboard is truncated in the paste operation
+ // when the clipboard contains null characters.
+ for (int i = 0; i < len - 1; ++i) {
+ if (s[i] == '\0')
+ s[i] = ' ';
+ }
+ }
};
/**