summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfsuit <wolfsuit>2003-05-10 19:43:08 (GMT)
committerwolfsuit <wolfsuit>2003-05-10 19:43:08 (GMT)
commitb9210133fb852362ce50e736dce33755ab8eb921 (patch)
tree06b38c386fbe2f4de84c36c80ebd9353ad85d406
parent780c535e9d5a3d6e29f9dd81118a3e690e7856c4 (diff)
downloadtk-b9210133fb852362ce50e736dce33755ab8eb921.zip
tk-b9210133fb852362ce50e736dce33755ab8eb921.tar.gz
tk-b9210133fb852362ce50e736dce33755ab8eb921.tar.bz2
macosx/tkMacOSXClipboard.c (TkSelGetSelection): Convert
'\r' to '\n' on the way into Tcl.
-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,