From 5fb1efae8f621a56ea4c93ff7dfb7e69c5bd2267 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 9 Oct 2014 23:25:56 +1100 Subject: Avoid extra space when pasting from external application on Windows. From Mitchell Foral. --- doc/ScintillaHistory.html | 3 +++ gtk/ScintillaGTK.cxx | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 79b302302..4b459c277 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -501,6 +501,9 @@ Feature #1080.
  • + For GTK+ on Windows, avoid extra space when pasting from external application. +
  • +
  • Support MinGW compilation under Linux. Feature #1077.
  • diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 7764f8ec2..0c45843ec 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -1564,6 +1564,13 @@ void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, Selectio len--; // Forget the extra '\0' #endif +#if PLAT_GTK_WIN32 + // Win32 includes an ending '\0' byte in 'len' for clipboard text from + // external applications; ignore it. + if ((len > 0) && (data[len - 1] == '\0')) + len--; +#endif + std::string dest(data, len); if (selectionTypeData == GDK_TARGET_STRING) { if (IsUnicodeMode()) { -- cgit v1.2.3