emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105497: Fix bidi cursor motion when


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105497: Fix bidi cursor motion when a line begins with a composed character.
Date: Fri, 19 Aug 2011 13:18:40 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105497
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Fri 2011-08-19 13:18:40 +0300
message:
  Fix bidi cursor motion when a line begins with a composed character.
  
   src/xdisp.c (RECORD_MAX_MIN_POS): If the display element comes from
   a composition, take its buffer position from IT->cmp_it.charpos.
modified:
  lisp/minibuffer.el
  src/ChangeLog
  src/xdisp.c
=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2011-08-15 16:10:39 +0000
+++ b/lisp/minibuffer.el        2011-08-19 10:18:40 +0000
@@ -1119,13 +1119,27 @@
                                       `(display (space :align-to ,column)))
                  nil))))
             (if (not (consp str))
-                (put-text-property (point) (progn (insert str) (point))
+                (put-text-property (point)
+                                  (progn
+                                    (insert (bidi-string-mark-left-to-right
+                                             str))
+                                    (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 str)))
+                                    (point))
                                    '(mouse-face nil
-                                     face completions-annotations)))
+                                               face completions-annotations)))
            (cond
             ((eq completions-format 'vertical)
              ;; Vertical format

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-08-18 18:46:02 +0000
+++ b/src/ChangeLog     2011-08-19 10:18:40 +0000
@@ -1,3 +1,10 @@
+2011-08-19  Eli Zaretskii  <address@hidden>
+
+       * xdisp.c (RECORD_MAX_MIN_POS): If the display element comes from
+       a composition, take its buffer position from IT->cmp_it.charpos.
+       Fixes cursor positioning at the beginning of a line that begins
+       with a composed character.
+
 2011-08-18  Eli Zaretskii  <address@hidden>
 
        * bidi.c (bidi_get_type): If bidi_type_table reports zero as the

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-08-16 14:28:19 +0000
+++ b/src/xdisp.c       2011-08-19 10:18:40 +0000
@@ -18386,15 +18386,22 @@
 #define RECORD_MAX_MIN_POS(IT)                                 \
   do                                                           \
     {                                                          \
-      if (IT_CHARPOS (*(IT)) < min_pos)                                \
+      int composition_p = (IT)->what == IT_COMPOSITION;                \
+      EMACS_INT current_pos =                                  \
+       composition_p ? (IT)->cmp_it.charpos                    \
+                     : IT_CHARPOS (*(IT));                     \
+      EMACS_INT current_bpos =                                 \
+       composition_p ? CHAR_TO_BYTE (current_pos)              \
+                     : IT_BYTEPOS (*(IT));                     \
+      if (current_pos < min_pos)                               \
        {                                                       \
-         min_pos = IT_CHARPOS (*(IT));                         \
-         min_bpos = IT_BYTEPOS (*(IT));                        \
+         min_pos = current_pos;                                \
+         min_bpos = current_bpos;                              \
        }                                                       \
-      if (IT_CHARPOS (*(IT)) > max_pos)                                \
+      if (current_pos > max_pos)                               \
        {                                                       \
-         max_pos = IT_CHARPOS (*(IT));                         \
-         max_bpos = IT_BYTEPOS (*(IT));                        \
+         max_pos = current_pos;                                \
+         max_bpos = current_bpos;                              \
        }                                                       \
     }                                                          \
   while (0)


reply via email to

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