summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--macosx/tkMacOSXClipboard.c15
2 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2a81335..0bb43be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-10 Jim Ingham <jingham@apple.com>
+
+ * macosx/tkMacOSXClipboard.c (TkSelGetSelection): Convert
+ '\r' to '\n' on the way into Tcl.
+
2003-05-08 Donal K. Fellows <fellowsd@cs.man.ac.uk>
* tests/image.test (image-15.1): Test to ensure that widgets pick
diff --git a/macosx/tkMacOSXClipboard.c b/macosx/tkMacOSXClipboard.c
index 7bfa7ce..26fde2a 100644
--- a/macosx/tkMacOSXClipboard.c
+++ b/macosx/tkMacOSXClipboard.c
@@ -9,7 +9,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.2 2002/08/31 06:12:29 das Exp $
+ * RCS: @(#) $Id: tkMacOSXClipboard.c,v 1.3 2003/05/10 19:43:08 wolfsuit Exp $
*/
#include "tkInt.h"
@@ -81,8 +81,9 @@ TkSelGetSelection(
}
if (length > 0) {
Tcl_DString encodedText;
+ char *data;
- buf = (char *)ckalloc(length+1);
+ buf = (char *) ckalloc(length + 1);
buf[length] = 0;
err = GetScrapFlavorData(scrapRef, 'TEXT', &length, buf);
if (err != noErr) {
@@ -90,7 +91,17 @@ TkSelGetSelection(
" GetScrapFlavorData failed.", (char *) NULL);
return TCL_ERROR;
}
+
+ /*
+ * Tcl expects '\n' not '\r' as the line break character.
+ */
+ for (data = buf; *data != '\0'; data++) {
+ if (*data == '\r') {
+ *data = '\n';
+ }
+ }
+
Tcl_ExternalToUtfDString(TkMacOSXCarbonEncoding, buf, length,
&encodedText);
result = (*proc)(clientData, interp,