emacs-diffs
[Top][All Lists]
Advanced

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

master 4c5efda: Merge from origin/emacs-28


From: Stefan Kangas
Subject: master 4c5efda: Merge from origin/emacs-28
Date: Tue, 23 Nov 2021 03:06:41 -0500 (EST)

branch: master
commit 4c5efda8d33e582c53a0d7a1d3dfabecaca038bd
Merge: 2955d46 d791cd5
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    Merge from origin/emacs-28
    
    d791cd556d Fix '(space :relative-width N)' display spec w/non-ASCII c...
    712898210f * lisp/proced.el (proced-sort-header): Fix event positions...
    
    # Conflicts:
    #   lisp/proced.el
---
 lisp/proced.el |  7 ++++---
 src/xdisp.c    | 30 ++++++++++++++++++++++--------
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/lisp/proced.el b/lisp/proced.el
index e959e91..9e9793a 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1333,11 +1333,12 @@ It is converted to the corresponding attribute key.
 This command updates the variable `proced-sort'.
 Prefix ARG controls sort order, see `proced-sort-interactive'."
   (interactive (list last-input-event (or last-prefix-arg 'no-arg)) 
proced-mode)
-  (let ((start (event-start event))
-        col key)
+  (let* ((start (event-start event))
+         (obj (posn-object start))
+         col key)
     (save-selected-window
       (select-window (posn-window start))
-      (setq col (+ (1- (car (posn-actual-col-row start)))
+      (setq col (+ (if obj (cdr obj) (posn-point start))
                    (window-hscroll)))
       (when (and (<= 0 col) (< col (length proced-header-line)))
         (setq key (get-text-property col 'proced-key proced-header-line))
diff --git a/src/xdisp.c b/src/xdisp.c
index 259d057..f6aa7fe 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -30017,7 +30017,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
 #endif /* HAVE_WINDOW_SYSTEM */
 
 /* Produce a stretch glyph for iterator IT.  IT->object is the value
-   of the glyph property displayed.  The value must be a list
+   of the display property.  The value must be a list of the form
    `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs
    being recognized:
 
@@ -30027,7 +30027,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
 
    2. `:relative-width FACTOR' specifies that the width of the stretch
    should be computed from the width of the first character having the
-   `glyph' property, and should be FACTOR times that width.
+   `display' property, and should be FACTOR times that width.
 
    3. `:align-to HPOS' specifies that the space should be wide enough
    to reach HPOS, a value in canonical character units.
@@ -30039,7 +30039,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
 
    5. `:relative-height FACTOR' specifies that the height of the
    stretch should be FACTOR times the height of the characters having
-   the glyph property.
+   the display property.
 
    Either none or exactly one of 4 or 5 must be present.
 
@@ -30060,10 +30060,11 @@ produce_stretch_glyph (struct it *it)
 #ifdef HAVE_WINDOW_SYSTEM
   int ascent = 0;
   bool zero_height_ok_p = false;
+  struct face *face;
 
   if (FRAME_WINDOW_P (it->f))
     {
-      struct face *face = FACE_FROM_ID (it->f, it->face_id);
+      face = FACE_FROM_ID (it->f, it->face_id);
       font = face->font ? face->font : FRAME_FONT (it->f);
       prepare_face_for_display (it->f, face);
     }
@@ -30084,14 +30085,27 @@ produce_stretch_glyph (struct it *it)
   else if (prop = Fplist_get (plist, QCrelative_width), NUMVAL (prop) > 0)
     {
       /* Relative width `:relative-width FACTOR' specified and valid.
-        Compute the width of the characters having the `glyph'
+        Compute the width of the characters having this `display'
         property.  */
       struct it it2;
-      unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
+      Lisp_Object object = it->stack[it->sp - 1].string;
+      unsigned char *p = (STRINGP (object)
+                         ? SDATA (object) + IT_STRING_BYTEPOS (*it)
+                         : BYTE_POS_ADDR (IT_BYTEPOS (*it)));
+      bool multibyte_p =
+       STRINGP (object) ? STRING_MULTIBYTE (object) : it->multibyte_p;
 
       it2 = *it;
-      if (it->multibyte_p)
-       it2.c = it2.char_to_display = string_char_and_length (p, &it2.len);
+      if (multibyte_p)
+       {
+         it2.c = it2.char_to_display = string_char_and_length (p, &it2.len);
+#ifdef HAVE_WINDOW_SYSTEM
+         if (FRAME_WINDOW_P (it->f) && ! ASCII_CHAR_P (it2.c))
+           it2.face_id = FACE_FOR_CHAR (it->f, face, it2.c,
+                                        IT_CHARPOS (*it),
+                                        STRINGP (object)? object : Qnil);
+#endif
+       }
       else
        {
          it2.c = it2.char_to_display = *p, it2.len = 1;



reply via email to

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