[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bidi-display-reordering is now non-nil by default

From: Eli Zaretskii
Subject: Re: bidi-display-reordering is now non-nil by default
Date: Thu, 18 Aug 2011 19:14:38 +0300

> From: Stefan Monnier <address@hidden>
> Date: Mon, 15 Aug 2011 14:13:21 -0400
> Cc: address@hidden, address@hidden
> And currently string-mark-left-to-right does the job just fine.

In line with the above, does the following patch look like TRT?  It is
needed, e.g., when displaying completions for C-x C-f when some of the
files in the directory end in R2L characters.  Since we cover the TAB
with a `(display (space :align-to ...))' property, which makes it a
``replacing'' display property, the underlying TAB loses its
bidirectional properties and is reordered as if it were a neutral
character.  So instead of

  OOF                RAB

I see

  RAB                OOF

which shows the candidates in the wrong order, especially if
completions-format is `vertical'.

If this patch is okay, can you tell whether other completion
facilities in Emacs might need similar changes?

=== modified file 'lisp/minibuffer.el'
--- lisp/minibuffer.el  2011-08-15 16:10:39 +0000
+++ lisp/minibuffer.el  2011-08-18 13:07:52 +0000
@@ -1119,13 +1119,24 @@ It also eliminates runs of equal strings
                                       `(display (space :align-to ,column)))
             (if (not (consp str))
-                (put-text-property (point) (progn (insert str) (point))
+                (put-text-property (point)
+                                  (progn
+                                    (insert (bidi-string-mark-left-to-right 
+                                    (point))
                                    'mouse-face 'highlight)
-              (put-text-property (point) (progn (insert (car str)) (point))
+              (put-text-property (point)
+                                (progn
+                                  (insert
+                                   (bidi-string-mark-left-to-right (car str)))
+                                  (point))
                                  'mouse-face 'highlight)
-              (add-text-properties (point) (progn (insert (cadr str)) (point))
+              (add-text-properties (point)
+                                  (progn
+                                    (insert
+                                     (bidi-string-mark-left-to-right (cadr 
+                                    (point))
                                    '(mouse-face nil
-                                     face completions-annotations)))
+                                               face completions-annotations)))
             ((eq completions-format 'vertical)
              ;; Vertical format

reply via email to

[Prev in Thread] Current Thread [Next in Thread]