From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Benjamin Riefenstahl Newsgroups: gmane.emacs.devel Subject: Re: copying to clipboard silently discards lines Date: Fri, 25 Feb 2005 18:24:46 +0100 Message-ID: References: <2150.220.255.172.231.1109220271.squirrel@220.255.172.231> <1515.220.255.172.231.1109259901.squirrel@220.255.172.231> <1156.220.255.172.231.1109344154.squirrel@www.stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1109353159 17763 80.91.229.2 (25 Feb 2005 17:39:19 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Feb 2005 17:39:19 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 25 18:39:19 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D4jPO-0002nJ-Ma for ged-emacs-devel@m.gmane.org; Fri, 25 Feb 2005 18:37:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D4jhB-0003xG-PN for ged-emacs-devel@m.gmane.org; Fri, 25 Feb 2005 12:56:09 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D4jej-0003H1-UX for emacs-devel@gnu.org; Fri, 25 Feb 2005 12:53:38 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D4jeY-0003C6-4V for emacs-devel@gnu.org; Fri, 25 Feb 2005 12:53:27 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D4jeY-000394-18 for emacs-devel@gnu.org; Fri, 25 Feb 2005 12:53:26 -0500 Original-Received: from [193.99.153.30] (helo=seneca.benny.turtle-trading.net) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1D4jEB-0007lu-JM for emacs-devel@gnu.org; Fri, 25 Feb 2005 12:26:11 -0500 Original-Received: from seneca.benny.turtle-trading.net.turtle-trading.net (seneca.benny.turtle-trading.net [127.0.0.1]) (authenticated bits=0) by seneca.benny.turtle-trading.net (8.12.8/8.12.8) with ESMTP id j1PHOkLn006048; Fri, 25 Feb 2005 18:24:53 +0100 Original-To: "Chong Yidong" In-Reply-To: <1156.220.255.172.231.1109344154.squirrel@www.stupidchicken.com> (Chong Yidong's message of "Fri, 25 Feb 2005 10:09:14 -0500 (EST)") User-Agent: Gnus/5.1001 (Gnus v5.10.1) Emacs/21.3.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:33806 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33806 Hi Chong Yidong, "Chong Yidong" writes: > The bug is in the Lisp_Object QUNICODE, which specifies the > "utf-16le-dos" coding system used by `selection-coding-system'. QUINCODE is just a symbol, a unique string. It is used for looking up the actual coding-system. setup_coding_system() in src/coding.c does that lookup by filling in the struct coding_system. > When a coding_system is extracted from QUNICODE, the parameter > coding->spec.ccl.encoder.buf_magnification is 1. This causes a call to > encoding_buffer_size (in convert_to_handle_as_coded, w32select.c:247) to > return a buffer size that is too small for the encoded string. > > I'm guessing the magnification has to be set to 2, because `abc...' > gets encoded to `a\0b\0c\0...' (encoding_buffer_size multiplies this > again by 2, because of the CRLF issue.) That would indicate that the coding-system "utf-16le-dos" itself has a bug. The source code description comment for encoding_buffer_size() says Return maximum size (bytes) of a buffer enough for encoding SRC_BYTES of text to CODING. which matches its usage in w32select.c, I think. > Trouble is, I can't find where the `spec.ccl...', or indeed any of > the other parameters of QUNICODE are initialized. Grep is our friend ;-). The coding-system (and its CCL programs) is created in lisp/international/ccl.el using (define-ccl-program ...). The parameter BUFFER_MAGNIFICATION for that function is set as 1 there for the encoders (ccl-encode-mule-utf-16le, ccl-encode-mule-utf-16be, ccl-encode-mule-utf-16le-with-signature, ccl-encode-mule-utf-16be-with-signature), so that might well be the problem. Can you try and replace that 1 with 2 and see if your problem goes away? benny