summaryrefslogtreecommitdiffstats
path: root/unix/tkUnixSelect.c
diff options
context:
space:
mode:
authorstanton <stanton>1999-06-03 18:50:45 (GMT)
committerstanton <stanton>1999-06-03 18:50:45 (GMT)
commit0e98ba9d85ade423311b36597aac1c0dad9e7f52 (patch)
tree3d3a9cd37eb4ab2165e0e578e370bd471b1ee333 /unix/tkUnixSelect.c
parent5076106e0dd6f3f514e876162568fb5ed028931c (diff)
downloadtk-0e98ba9d85ade423311b36597aac1c0dad9e7f52.zip
tk-0e98ba9d85ade423311b36597aac1c0dad9e7f52.tar.gz
tk-0e98ba9d85ade423311b36597aac1c0dad9e7f52.tar.bz2
* unix/tkUnixSelect.c:
* tests/unixSelect.test: * generic/tkSelect.c: Fixed selection code to handle Unicode data in COMPOUND_TEXT and STRING selections. [Bug: 1791]
Diffstat (limited to 'unix/tkUnixSelect.c')
-rw-r--r--unix/tkUnixSelect.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/unix/tkUnixSelect.c b/unix/tkUnixSelect.c
index c94c0be..e3d6b56 100644
--- a/unix/tkUnixSelect.c
+++ b/unix/tkUnixSelect.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: tkUnixSelect.c,v 1.5 1999/06/01 18:51:20 stanton Exp $
+ * RCS: @(#) $Id: tkUnixSelect.c,v 1.6 1999/06/03 18:50:46 stanton Exp $
*/
#include "tkInt.h"
@@ -24,7 +24,7 @@ typedef struct ConvertInfo {
* offset of the next chunk of data to
* transfer. */
Tcl_EncodingState state; /* The encoding state needed across chunks. */
- char buffer[TCL_UTF_MAX+1]; /* A buffer to hold part of a UTF character
+ char buffer[TCL_UTF_MAX]; /* A buffer to hold part of a UTF character
* that is split across chunks.*/
} ConvertInfo;
@@ -322,6 +322,7 @@ TkSelPropProc(eventPtr)
*/
numItems = 0;
+ length = 0;
} else {
TkSelInProgress ip;
ip.selPtr = selPtr;
@@ -424,6 +425,10 @@ TkSelPropProc(eventPtr)
}
Tcl_DStringSetLength(&ds, soFar);
+ if (encoding) {
+ Tcl_FreeEncoding(encoding);
+ }
+
/*
* Set the property to the encoded string value.
*/
@@ -484,7 +489,12 @@ TkSelPropProc(eventPtr)
incrPtr->converts[i].offset = -2;
}
} else {
- incrPtr->converts[i].offset += numItems;
+ /*
+ * Advance over the selection data that was consumed
+ * this time.
+ */
+
+ incrPtr->converts[i].offset += numItems - length;
}
return;
}