From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#13399: 24.3.50; Word-wrap can't wrap at zero-width space U-200B Date: Fri, 08 Dec 2017 17:38:29 +0200 Message-ID: <83609hw7pm.fsf@gnu.org> References: <50EE7BE5.2060806@gmx.at> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1512747615 18238 195.159.176.226 (8 Dec 2017 15:40:15 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 8 Dec 2017 15:40:15 +0000 (UTC) Cc: 13399@debbugs.gnu.org To: Adam Tack Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 08 16:40:11 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNKkz-0004Xs-HN for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Dec 2017 16:40:09 +0100 Original-Received: from localhost ([::1]:37797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNKl6-0000sI-VG for geb-bug-gnu-emacs@m.gmane.org; Fri, 08 Dec 2017 10:40:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34440) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNKky-0000oB-5N for bug-gnu-emacs@gnu.org; Fri, 08 Dec 2017 10:40:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNKks-0004pM-E5 for bug-gnu-emacs@gnu.org; Fri, 08 Dec 2017 10:40:08 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44024) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eNKks-0004p9-AC for bug-gnu-emacs@gnu.org; Fri, 08 Dec 2017 10:40:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eNKks-00020c-2x for bug-gnu-emacs@gnu.org; Fri, 08 Dec 2017 10:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Dec 2017 15:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13399 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13399-submit@debbugs.gnu.org id=B13399.15127475427636 (code B ref 13399); Fri, 08 Dec 2017 15:40:02 +0000 Original-Received: (at 13399) by debbugs.gnu.org; 8 Dec 2017 15:39:02 +0000 Original-Received: from localhost ([127.0.0.1]:52705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNKjt-0001z4-Vw for submit@debbugs.gnu.org; Fri, 08 Dec 2017 10:39:02 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:43191) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNKjs-0001yY-E4 for 13399@debbugs.gnu.org; Fri, 08 Dec 2017 10:39:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNKjj-0003xc-BP for 13399@debbugs.gnu.org; Fri, 08 Dec 2017 10:38:55 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:40616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNKjj-0003xT-8C; Fri, 08 Dec 2017 10:38:51 -0500 Original-Received: from [176.228.60.248] (port=3220 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eNKji-0005Te-EO; Fri, 08 Dec 2017 10:38:51 -0500 In-reply-to: (message from Adam Tack on Fri, 8 Dec 2017 01:02:08 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:140820 Archived-At: > From: Adam Tack > Date: Fri, 8 Dec 2017 01:02:08 +0000 > > I have a patch for the original issue of word-wrap not wrapping at a > zero-width space. The implementation uses a character table, and is > closely based on that written by Martin Rudalics > (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13399#113), with Eli > Zaretski's suggestions regarding unicode. Thanks for working on this! > However, this is my first foray into modifying a serious C codebase, > so I am not sure if I have done the right thing. In particular, I > have serious doubts about the second and third cases from > IT_DISPLAYING_WHITESPACE, especially since I don't really know when > they would be applicable. > > || ((STRINGP (it->string) \ > && !NILP (CHAR_TABLE_REF \ > (Vword_wrap_chars, STRING_CHAR \ > (SDATA (it->string) + IT_STRING_BYTEPOS (*it))))) \ > || (it->s && !NILP (CHAR_TABLE_REF \ > (Vword_wrap_chars, \ > STRING_CHAR(it->s + IT_BYTEPOS (*it))))) \ I think this is okay, but maybe the macro could be converted into an inline function, and then fetching the character from the various objects separated from looking up the char-table for that character? > Additionally, I'm not certain whether syms_of_character in character.c > is the right location for the definition of the char-table and whether > the range of characters U+2000 to U+200B should be in the chartable, > or if it should just be space and tab, by default. Well, since it's a char-table, users will probably want to control which characters cause word-wrap. One idea would be to have a minor mode or some such, providing users an ability to include or exclude different groups of related whitespace characters as a whole? This could be in follow-up patches, though. We could also look at LineBreak.txt in the Unicode database for inspiration and ideas. But I do think that the default should be only TAB and SPC, as Emacs always did, and the rest should be optional, and probably in Lisp, not C. > I am aware that if this were to be accepted, I would also need to make > a change to etc/NEWS, probably the docstring of `word-wrap' and > somewhere in the Texinfo manual. And also a couple of tests (the ones you used would be a good start). > I have not yet filled out a copyright assignment form, though I will > do so if this patch (modulo changes) is considered acceptable. I will send the forms off-list, thanks.