From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Word wrap for non-whitespace-seperated language Date: Thu, 5 Mar 2020 17:33:49 -0500 Message-ID: <6DE83788-5296-4C4F-A265-88B33A43DC93@gmail.com> References: <838skgvu2l.fsf@gnu.org> <3692AB81-B291-4D14-BEDE-924F020D94ED@gmail.com> <837e00vsk9.fsf@gnu.org> <9737C398-80FC-4377-91BA-C0891BD5A0F5@gmail.com> <835zfjwgyb.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.60.0.2.5\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="25844"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 05 23:34:30 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 1j9z4Y-0006bh-9K for ged-emacs-devel@m.gmane-mx.org; Thu, 05 Mar 2020 23:34:30 +0100 Original-Received: from localhost ([::1]:56914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9z4X-0002uS-BU for ged-emacs-devel@m.gmane-mx.org; Thu, 05 Mar 2020 17:34:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35993) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j9z3z-0002Gi-9Y for emacs-devel@gnu.org; Thu, 05 Mar 2020 17:33:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j9z3y-0004Nt-92 for emacs-devel@gnu.org; Thu, 05 Mar 2020 17:33:55 -0500 Original-Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]:34249) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j9z3w-0004Kk-VM; Thu, 05 Mar 2020 17:33:53 -0500 Original-Received: by mail-qv1-xf36.google.com with SMTP id o18so94301qvf.1; Thu, 05 Mar 2020 14:33:52 -0800 (PST) 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=iEG4Qktc+1y1q2I2PbOr0d9ZPw12FPHsdRvsN03i+R4=; b=rIgwLl19L+dz0VhlffKN8wy/6z+SZr64aAUgdhrUgHNi4P0wJEMsteNALRaakMJ9GP wdw1FpQ9TkDXpKssieG3G+RV1JOAYRVoG9Fh5Fk+9G+ofEPJlzVqBhIVDBIxdhVkbT/9 r15qGY2vi9T4c65QzO4p9qMzGu6P9Mnw+Si1YEYWFMxl2P8CBaM4niMTBkdYk4gTLVW0 OQkfjZwGC2O4rKajxcPv7NJT5iOBCQuw6wNvIFGcRs5EOYGZ0Qsypufb1wnlGScNaU97 I71I5G2ORH8299vVVVuCYs7ijLhjcKpHhHGl7y3qa5Khg2aXROCLKqElVhLWLegmpD1Q HF8g== 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=iEG4Qktc+1y1q2I2PbOr0d9ZPw12FPHsdRvsN03i+R4=; b=KqjK0HOABnKaOIHeJg6ujhydo9fhOhDRv4Xem6ubOheTQJlUaFZ//FkblQcN9ttarz jocgMcuV4OI6L6bOkjSFWQKSi04Wje/AiXa8OiyZ/QTmbAeifM3kYFJ4+deF7cyLA7Ma Fp7ZNFakPUDT98l5yK53UhiZf8z4UIPJddECdcAgs4icDhvIP4WLuFP4/uY7fAgF8b4V aHfDnV50lgQdrbRLNnet/ppNPoR2jntognIEr6jXefOm9ZglWsmpmPNppThU1ae6PiF3 VmAbOyDy4Wpk/DyTSPOUD2vAaBgkhTcZkVOhw7Mma4kI4RDtH9S4ja8dAzRkzzwEeHGs rf8w== X-Gm-Message-State: ANhLgQ2EbKCL8EacbZ1x2gvKK7qZ/V+MTu7GImOKE8Yp2Jm2IURlhPqz wDUY2GG+exrou742YpTWWCz623v9JbmXnQ== X-Google-Smtp-Source: ADFU+vspEcGLOOx8A88oiZNrl/hdKgT73GPfOvKM/W+V/HLqyyw66poQLOqYlXZxuAKE8UBLvEcNww== X-Received: by 2002:ad4:558c:: with SMTP id e12mr475225qvx.89.1583447632087; Thu, 05 Mar 2020 14:33:52 -0800 (PST) Original-Received: from [104.39.198.240] ([104.39.198.240]) by smtp.gmail.com with ESMTPSA id p126sm16605224qkd.108.2020.03.05.14.33.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2020 14:33:51 -0800 (PST) In-Reply-To: <835zfjwgyb.fsf@gnu.org> X-Mailer: Apple Mail (2.3608.60.0.2.5) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f36 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:245277 Archived-At: I wrote something that works. The goal is to have a word wrap effect for = variable pitch words while breaking not only on white space characters = but also between CJK characters. fill.el doesn=E2=80=99t work because it = doesn=E2=80=99t work for variable pitch fonts, word-wrap doesn=E2=80=99t = work because it can=E2=80=99t break between CJK characters. The key = point is to find the place to break, my current method is forward char = until the x position of point exceeds certain value (say 70*7 pixels). = This has two flaws: first, forward char-by-char is very slow, although I = added some simple optimizations, the lag is still noticeable even with = small paragraphs. Second, I can=E2=80=99t get the position of point if = it goes out of the window, in which case I need to recenter.=20 Is there a better way to search forward for a point such that it=E2=80=99s= x position is larger than some value? (Come think of it, is it possible = to find a point in a window by x-y coordinate?) Thanks. Yuan=