diff options
| -rw-r--r-- | src/Editor.h | 13 | 
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] = ' '; +		} +	}  };  /**  | 
