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: Bidirectional text in tooltips Date: Sat, 06 Nov 2010 16:14:51 +0200 Message-ID: <838w16o7xg.fsf@gnu.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: dough.gmane.org 1289053935 734 80.91.229.12 (6 Nov 2010 14:32:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 6 Nov 2010 14:32:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 06 15:32:10 2010 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.69) (envelope-from ) id 1PEjoH-00005k-1v for ged-emacs-devel@m.gmane.org; Sat, 06 Nov 2010 15:32:08 +0100 Original-Received: from localhost ([127.0.0.1]:56408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PEjXz-0004yL-2B for ged-emacs-devel@m.gmane.org; Sat, 06 Nov 2010 10:15:11 -0400 Original-Received: from [140.186.70.92] (port=45292 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PEjXr-0004xg-WB for emacs-devel@gnu.org; Sat, 06 Nov 2010 10:15:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PEjXb-0006Ac-B8 for emacs-devel@gnu.org; Sat, 06 Nov 2010 10:14:48 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:63585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PEjXb-0006AX-2f for emacs-devel@gnu.org; Sat, 06 Nov 2010 10:14:47 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LBG00500VFHWK00@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Sat, 06 Nov 2010 16:14:45 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([77.126.249.126]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LBG004F6VKKO9E0@a-mtaout22.012.net.il> for emacs-devel@gnu.org; Sat, 06 Nov 2010 16:14:45 +0200 (IST) X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.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:132417 Archived-At: I have committed to trunk revision 102265, which makes tooltips support bidirectional text. I made changes in w32fns.c and in xfns.c= . Only the former is fully tested, for the latter I could only test tha= t it builds correctly. Please make sure the X build works as well (you will find test cases near the end of this mail). There remain two cases where I don't see in the sources the same code as in xfns.c and w32fns.c. One is the GTK build, which under x_gtk_use_system_tooltips calls xg_prepare_tooltip and xg_show_tooltip, which use GTK features to display tooltips. Can someone see if GTK does TRT when it shows tooltips with bidirectional text (again, using the text cases below)? If it doesn't, we will nee= d to find a way to fix that somehow. The other case is NS. IIUC, the place that calculates the width of the tooltip is the setText method of the EmacsTooltip class, implemented on nsmenu.m. My reading of the setText method is that it assumes a single line of text in the tip, is that right? If so, that's a bug in itself, I think. In any case, if the NS build uses the string length, it relies on the NS toolkit to DTRT, I think; can someone please see if the results are satisfactory? To test bidirectional tooltips, evaluate in "emacs -Q": (setq-default bidi-display-reordering t) and then use these two test cases (copy-paste them into *scratch*): (x-show-tip "=D7=A9=D7=9C=D7=95=D7=9D, =D7=A2=D7=95=D7=9C=D7=9D =D7= =90=D7=9B=D7=96=D7=A8 =D7=95=D7=9E=D7=9B=D7=95=D7=A2=D7=A8!") (x-show-tip "=D7=A9=D7=9C=D7=95=D7=9D, =D7=A2=D7=95=D7=9C=D7=9D =D7= =90=D7=9B=D7=96=D7=A8 =D7=95=D7=9E=D7=9B=D7=95=D7=A2=D7=A8! Hello, world!") The first one should show a one-line tooltip, the second a 3-line tooltip (with the 2nd line empty). In both cases, the tooltip should be just wide enough to display the entire text of each non-empty line= . (With previous code, you'd see an ugly 80-column wide tooltip in both cases.) In the second test case, the first line should be flushed al= l the way to the right edge of the tooltip, while the last line should be flushed to the left. TIA