From 499359e6090a0e60c2f59e4eab4ee027506a13be Mon Sep 17 00:00:00 2001 From: Vivian De Smedt Date: Tue, 8 Jan 2013 10:16:10 +0100 Subject: Bug: [#1289]. Replace null characters by spaces in the clipboard to avoid that its content is truncated in the paste operation. --- src/Editor.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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] = ' '; + } + } }; /** -- cgit v1.2.3