emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 62831e7: Fix 'current-column' in presence of :relat


From: Eli Zaretskii
Subject: [Emacs-diffs] master 62831e7: Fix 'current-column' in presence of :relative-width
Date: Tue, 22 Sep 2015 16:34:59 +0000

branch: master
commit 62831e7c3ff97c00474d2fcf41866d45afb3a153
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix 'current-column' in presence of :relative-width
    
    * src/indent.c (check_display_width): Support ':relative-width'
    in a display spec that specifies a stretch glyph.  (Bug#21533)
---
 src/indent.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/src/indent.c b/src/indent.c
index ded1843..584f217 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -485,7 +485,9 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, 
ptrdiff_t *endpos)
         : MOST_POSITIVE_FIXNUM);
 
       if ((prop = Fplist_get (plist, QCwidth),
-          RANGED_INTEGERP (0, prop, INT_MAX)))
+          RANGED_INTEGERP (0, prop, INT_MAX))
+         || (prop = Fplist_get (plist, QCrelative_width),
+             RANGED_INTEGERP (0, prop, INT_MAX)))
        width = XINT (prop);
       else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop)
               && XFLOAT_DATA (prop) <= INT_MAX)
@@ -504,6 +506,18 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, 
ptrdiff_t *endpos)
            *endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
          else
            get_property_and_range (pos, Qdisplay, &val, &start, endpos, Qnil);
+
+         /* For :relative-width, we need to multiply by the column
+            width of the character at POS, if it is greater than 1.  */
+         if (!NILP (Fplist_get (plist, QCrelative_width))
+             && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
+           {
+             int b, wd;
+             unsigned char *p = BYTE_POS_ADDR (CHAR_TO_BYTE (pos));
+
+             MULTIBYTE_BYTES_WIDTH (p, buffer_display_table (), b, wd);
+             width *= wd;
+           }
          return width;
        }
     }



reply via email to

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