diff options
author | wolfsuit <wolfsuit> | 2003-05-10 19:43:08 (GMT) |
---|---|---|
committer | wolfsuit <wolfsuit> | 2003-05-10 19:43:08 (GMT) |
commit | b9210133fb852362ce50e736dce33755ab8eb921 (patch) | |
tree | 06b38c386fbe2f4de84c36c80ebd9353ad85d406 /macosx | |
parent | 780c535e9d5a3d6e29f9dd81118a3e690e7856c4 (diff) | |
download | tk-b9210133fb852362ce50e736dce33755ab8eb921.zip tk-b9210133fb852362ce50e736dce33755ab8eb921.tar.gz tk-b9210133fb852362ce50e736dce33755ab8eb921.tar.bz2 |
macosx/tkMacOSXClipboard.c (TkSelGetSelection): Convert
'\r' to '\n' on the way into Tcl.
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tkMacOSXClipboard.c | 15 |
1 files changed, 13 insertions, 2 deletions
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, |