From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: How to recognize keyboard insertion? Date: Sun, 01 Nov 2009 21:57:27 +0200 Message-ID: <83bpjmc920.fsf@gnu.org> References: <83vdhvd096.fsf@gnu.org> <4AEC6CC5.3010009@harpegolden.net> <83skczcwes.fsf@gnu.org> <4AECE4BB.9010900@gnu.org> <83hbtedh8z.fsf@gnu.org> <87fx8yddex.fsf@uwakimon.sk.tsukuba.ac.jp> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1257105493 25882 80.91.229.12 (1 Nov 2009 19:58:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Nov 2009 19:58:13 +0000 (UTC) Cc: david@harpegolden.net, emacs-devel@gnu.org, jasonr@gnu.org To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 01 20:58:06 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N4gYr-0007JP-U9 for ged-emacs-devel@m.gmane.org; Sun, 01 Nov 2009 20:58:02 +0100 Original-Received: from localhost ([127.0.0.1]:59671 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4gYr-0000Yd-A3 for ged-emacs-devel@m.gmane.org; Sun, 01 Nov 2009 14:58:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N4gYk-0000Vy-2d for emacs-devel@gnu.org; Sun, 01 Nov 2009 14:57:54 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N4gYf-0000R7-9I for emacs-devel@gnu.org; Sun, 01 Nov 2009 14:57:53 -0500 Original-Received: from [199.232.76.173] (port=38362 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N4gYe-0000Qu-Ro for emacs-devel@gnu.org; Sun, 01 Nov 2009 14:57:48 -0500 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:51091) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N4gYb-0006HO-Hm; Sun, 01 Nov 2009 14:57:45 -0500 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0KSG00I004P5BY00@a-mtaout23.012.net.il>; Sun, 01 Nov 2009 21:57:25 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.70.37.193]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KSG00GOL4ROYL50@a-mtaout23.012.net.il>; Sun, 01 Nov 2009 21:57:25 +0200 (IST) In-reply-to: <87fx8yddex.fsf@uwakimon.sk.tsukuba.ac.jp> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) 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 Xref: news.gmane.org gmane.emacs.devel:116561 Archived-At: > From: "Stephen J. Turnbull" > Cc: Jason Rumney , > emacs-devel@gnu.org, > david@harpegolden.net > Date: Sun, 01 Nov 2009 14:25:42 +0900 > > Eli Zaretskii writes: > > > > User types: ABCD(4+5)*9 > > > Displayed as: (4+5)*9DCBA Parens here must be LTR > > > > No, it's displayed as 9*(4+5)DCBA. > > That seems weird to me. From my (probably imperfect) understanding of > UAX#9 I would expect the following sequence of displays starting with > an empty buffer (notation: uppercase letters are RTL, lowercase > letters and digits are LTR, -!- is point): > > -!- > -!-A > -!-BA > -!-CBA > -!-DCBA > -!-)DCBA > 4-!-)DCBA > 4+-!-)DCBA > 4+5-!-)DCBA [1] > -!-(4+5)DCBA <-- point jumps > (4+5)*-!-DCBA <-- point jumps again > (4+5)*9-!-DCBA (When you say "point jumps", you actually mean "cursor jumps", right? Because point does not jump at all, it always is after the last character typed on each of the above lines.) > I gather you're saying the correct interpretation of UAX#9 is > (starting from [1]): > > 4+5-!-)DCBA [1] > -!-(4+5)DCBA <-- point jumps > -!-*(4+5)DCBA > 9-!-*(4+5)DCBA Not exactly. I didn't say anything about point or cursor location. UAX#9 does not specify where to put the cursor and how it should move during text insertion, and different implementations do it differently for various reasons, some valid, some less so. (There are two equally ``correct'' locations of the cursor, because buffer position changes non-linearly with screen position, and "between two adjacent characters" is no longer well defined.) I didn't yet implement in Emacs anything beyond basic logical-order cursor motion, whereby C-f moves to the next character in the logical order. I expect some quite heated debates regarding this, when the time comes. But for now I'm deliberately ignoring this issue, because it's not a fundamental one. It's a usability and UI issue, and all I care at this point is to provide enough infrastructure to implement any behavior we will want (and probably more than one) when the time comes. Coming back to the example, cursor motion is not important here. Assume that this text comes from a file, where you have ABCD(4+5)*9 in logical order. The way this will be displayed depends on the properties of the characters. The key reason for the fact that * and 9 are to the left of the (4+5) is that (, ), and + are all "neutral" characters, in UAX#9 parlance, while * is a "weak separator" character. That, and the fact that numbers get higher resolved levels than the surrounding text, see 3.3.5 in UAX#9. That's why "*9" is not rendered to the right of "(4+5)".