Explorar o código

Merge pull request #40533 from zaevi/fix_clipboard_crlf

fix crlf for clipboard
Rémi Verschelde %!s(int64=5) %!d(string=hai) anos
pai
achega
103b46733a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      platform/windows/display_server_windows.cpp

+ 1 - 1
platform/windows/display_server_windows.cpp

@@ -170,7 +170,7 @@ void DisplayServerWindows::clipboard_set(const String &p_text) {
 
 	// Convert LF line endings to CRLF in clipboard content
 	// Otherwise, line endings won't be visible when pasted in other software
-	String text = p_text.replace("\n", "\r\n");
+	String text = p_text.replace("\r\n", "\n").replace("\n", "\r\n"); // avoid \r\r\n
 
 	if (!OpenClipboard(windows[last_focused_window].hWnd)) {
 		ERR_FAIL_MSG("Unable to open clipboard.");