From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Chong Yidong" Newsgroups: gmane.emacs.devel Subject: Re: copying to clipboard silently discards lines Date: Fri, 25 Feb 2005 10:09:14 -0500 (EST) Message-ID: <1156.220.255.172.231.1109344154.squirrel@www.stupidchicken.com> References: <2150.220.255.172.231.1109220271.squirrel@220.255.172.231> <1515.220.255.172.231.1109259901.squirrel@220.255.172.231> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1109344602 19563 80.91.229.2 (25 Feb 2005 15:16:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Feb 2005 15:16:42 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 25 16:16:41 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D4h5L-0001HT-Od for ged-emacs-devel@m.gmane.org; Fri, 25 Feb 2005 16:08:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D4hLS-0000Wn-PV for ged-emacs-devel@m.gmane.org; Fri, 25 Feb 2005 10:25:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D4hKi-0000QF-7u for emacs-devel@gnu.org; Fri, 25 Feb 2005 10:24:49 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D4hKe-0000Or-Cj for emacs-devel@gnu.org; Fri, 25 Feb 2005 10:24:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D4hKe-0000OQ-9n for emacs-devel@gnu.org; Fri, 25 Feb 2005 10:24:44 -0500 Original-Received: from [64.21.80.18] (helo=shark.dnsvelocity.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1D4h5m-0004YQ-7K for emacs-devel@gnu.org; Fri, 25 Feb 2005 10:09:22 -0500 Original-Received: from stupidch by shark.dnsvelocity.com with local (Exim 4.44) id 1D4h5e-00064X-3L for emacs-devel@gnu.org; Fri, 25 Feb 2005 10:09:14 -0500 Original-Received: from 220.255.172.231 ([220.255.172.231]) (SquirrelMail authenticated user cyd@stupidchicken.com) by www.stupidchicken.com with HTTP; Fri, 25 Feb 2005 10:09:14 -0500 (EST) In-Reply-To: <1515.220.255.172.231.1109259901.squirrel@220.255.172.231> Original-To: emacs-devel@gnu.org User-Agent: SquirrelMail/1.4.4 X-Priority: 3 (Normal) Importance: Normal X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - shark.dnsvelocity.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [32675 33085] / [47 12] X-AntiAbuse: Sender Address Domain - stupidchicken.com X-Source: /usr/local/cpanel/3rdparty/bin/php X-Source-Args: /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/3rdparty/squirrelmail/src/compose.php X-Source-Dir: :/base/3rdparty/squirrelmail/src 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:33799 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:33799 I sent an email to emacs-pretest-bug earlier about NTEmacs silently discarding lines copied onto the clipboard. I've identified the problem, but I don't know enough about coding systems to come up with a fix. Maybe someone can help me out here. The bug is in the Lisp_Object QUNICODE, which specifies the "utf-16le-dos" coding system used by `selection-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.) This bug did not exist prior to the unicode support patch, because Emacs used the iso2022 coding system for selections. Trouble is, I can't find where the `spec.ccl...', or indeed any of the other parameters of QUNICODE are initialized. The only place I can see that sets anything in QUNICODE is w32select.c:1074, which is just QUNICODE = intern ("utf-16le-dos"); Could someone with knowledge of coding systems and/or w32select.c help?