From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Line wrap reconsidered Date: Sun, 19 Jul 2020 12:16:32 -0400 Message-ID: <641EB401-D146-4EF0-AE92-994822C665AE@gmail.com> References: <92FF4412-04FB-4521-B6CE-52B08526E4E5@gmail.com> <878shfsq35.fsf@gnus.org> <83imgivjak.fsf@gnu.org> <83lfletr03.fsf@gnu.org> <4895C6EE-5E1F-44BF-93C1-CC5F7C096F73@gmail.com> <9766BA3D-B8F9-456B-9F59-60D21B86E390@gmail.com> <83sgfls2ul.fsf@gnu.org> <83v9kgq6jy.fsf@gnu.org> <5E75D1E2-8BFF-45DA-A643-40DBD5784508@gmail.com> <83r1v3qlel.fsf@gnu.org> <83blm6lzj3.fsf@gnu.org> <83pnakj8fs.fsf@gnu.org> <83k10sj60l.fsf@gnu.org> <0B30F8C8-9B8F-4FCB-B9FB-1B5A0E993CDB@gmail.com> <838sgjzij2.fsf@gnu.org> <83sgerxmbs.fsf@gnu.org> <83bllfx80g.fsf@gnu.org> <2F9680C4-11D8-4092-A485-2590AAF62CC9@gmail.com> <837dw2ykeb.fsf@gnu.org> <43C485E7-A9E7-448A-B1EC-9085F83670E9@gmail.com> <83365woafv.fsf@gnu.org> <214EBF50-8BEE-4935-9DE9-526E82F7D85C@gmail.com> <838sfhi6hm.fsf@gnu.org> <3A15EC3E-78EC-40BA-8841-47B3F9749092@gmail.com> <83sgdnh80n.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17262"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jul 19 18:17:11 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxBzy-0004NO-Da for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Jul 2020 18:17:10 +0200 Original-Received: from localhost ([::1]:36688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jxBzx-0004dO-F0 for ged-emacs-devel@m.gmane-mx.org; Sun, 19 Jul 2020 12:17:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jxBzR-0004CS-V1 for emacs-devel@gnu.org; Sun, 19 Jul 2020 12:16:37 -0400 Original-Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]:44340) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jxBzQ-0001xk-3g; Sun, 19 Jul 2020 12:16:37 -0400 Original-Received: by mail-qv1-xf35.google.com with SMTP id di5so6355382qvb.11; Sun, 19 Jul 2020 09:16:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=tAWlcreCtMh7yd8Gq9UdZ1UIwGAWUuuMCjdM1p1DX/k=; b=SvTF3mdzkQ6hA5XQjG7H3+QfVwj9S7yQEje3AEJisZ3FWSv0+ahmbkSKO4MfsKPIMv nFj5wC35+2cNZY9EzR1IdbZzvXPmG39d8YIbbiRgRs7w1QYyXt13TG6kJZkT9jSGzxpK Ng62sEU9BUzFlVpQM+Wt5wL9nE3g9kPdqwidKLrnxqOZ1ORvX2rQPyG9ymI8Y+aIGVou +sRKrGB/QeIrPFklxP56zFSShlQ2wdKNmguKrAbm0mF8r7GljjzkSGswNIC2SBKtouVl 8sZ0q7dmYPndrlaz9EEdge13ur6faQ5JPe6VXaKDSWTPiSUDhh794OLG7y2hjSnQqztX JJFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=tAWlcreCtMh7yd8Gq9UdZ1UIwGAWUuuMCjdM1p1DX/k=; b=oxuno69zMbJ/n55a1jxo4XlZG5Tr9kDKOu/IuE38HAHgRj7VyAP3tau2TBxFkLsSwq RAWHHF6ZCC2dY03HMGQpApU2IocIXiUpPNGi1752WfaCiDc6tHo0RFGzYGb4soZF4IvG n6f4IkpUenN2BIC7rD4ZxR3zL0k1mxNPzJX7gLPv7eh0coIWlsEmAtQqihpAjrfTPabf DBg2nIV5QN1wZTlA5bVAQDnnoozJbtgNKiv/WDCDEz3R4jw+Duni2aQbmLt9kxwNI87A IcUlt6KGji9re7YFKqYdhp5yha15ULqRKp9IlAo1HjwzkVSo6VvLbA0ElH0VVIqKbRqa xAGQ== X-Gm-Message-State: AOAM533nHOZbtZtvLf1eifVwVOGnLBAHu6u59qSio3jGHjFRc3SI7HV8 lj588iXduZRmOgVWvgIZrxFM41RoOWLtAw== X-Google-Smtp-Source: ABdhPJwZqDpxFDIEyGjPxOi20Xit8xsZNGJmP/0qqpp7x5qoTVKtoQmo84EV1wdYvUL8V4bSyi8EtQ== X-Received: by 2002:a05:6214:14f4:: with SMTP id k20mr18135348qvw.231.1595175393857; Sun, 19 Jul 2020 09:16:33 -0700 (PDT) Original-Received: from ?IPv6:2601:98a:4200:9210:b1a4:698a:a830:29b1? ([2601:98a:4200:9210:b1a4:698a:a830:29b1]) by smtp.gmail.com with ESMTPSA id z60sm16841531qtc.30.2020.07.19.09.16.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jul 2020 09:16:33 -0700 (PDT) In-Reply-To: <83sgdnh80n.fsf@gnu.org> X-Mailer: Apple Mail (2.3608.80.23.2.2) Received-SPF: pass client-ip=2607:f8b0:4864:20::f35; envelope-from=casouri@gmail.com; helo=mail-qv1-xf35.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:253108 Archived-At: > On Jul 19, 2020, at 10:52 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Sat, 18 Jul 2020 13:14:15 -0400 >> Cc: Lars Ingebrigtsen , >> emacs-devel@gnu.org >>=20 >>> A minor stylistic nit: I'd prefer the if - elseif clauses to yield = the >>> relevant character, and then apply CHAR_HAS_CATEGORY only once to = that >>> character at the end. (It is generally better to have only one = return >>> point from a function, especially when the function is short. If >>> nothing else, it makes debugging easier.) >>=20 >> I changed the it, do you code below this is ok? >>=20 >> if (ch =3D=3D 0) >> return false; >> else >> return CHAR_HAS_CATEGORY(ch, cat); >=20 > Yes. Or any of the variants shown by Stefan. Cool. >=20 >>>> if (it->line_wrap =3D=3D WORD_WRAP && it->area =3D=3D = TEXT_AREA) >>>> { >>>> - if (IT_DISPLAYING_WHITESPACE (it)) >>>> - may_wrap =3D true; >>>> - else if (may_wrap) >>>> + /* Can we wrap here? */ >>>> + if (may_wrap && char_can_wrap_before (it)) >>>=20 >>> Likewise here. >>=20 >>=20 >> In both can_wrap_before and can_wrap_after, I have a short circuit = for the case when cjk_word_wrap is nil: >>=20 >> if (!Vcjk_word_wrap) >> return IT_DISPLAYING_WHITESPACE (it); >>=20 >> That should guarantee the old behavior when cjk_word_wrap is nil, if = that=E2=80=99s what you are asking about. >=20 > I've seen that, but what bothers me is not this. It's the fact that > the old code didn't test may_wrap, whereas the new code does. >=20 I see. I changed the code a bit and added some explanation in the commit = message. Hopefully that will convince you that the new logic is = equivalent to the old one when cjk-word-wrap is nil. >>>> + DEFVAR_BOOL("cjk-word-wrap", Vcjk_word_wrap, >>>> + doc: /* Non-nil means wrap after CJK chracters. >>>=20 >>> This is unclear. Does it mean after _any_ CJK character, or just >>> after some? And if the latter, which ones? >>=20 >> I added more detail and hopefully they are clearer now. >=20 > Looks much better, thanks. BTW, any ideas for alternatives for cjk-word-wrap? Maybe = extended-word-wrap? Yuan