aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2021-11-23 08:49:49 +0100
committerStefan Kangas2021-11-23 08:49:49 +0100
commit4c5efda8d33e582c53a0d7a1d3dfabecaca038bd (patch)
tree8ed63baa5c6d6d17399c8b2292b179d2b2548ea8
parent2955d46c00430b38310d0fae968adea91e2bbc3d (diff)
parentd791cd556d622accb935e4dd230023c485d1e07a (diff)
downloademacs-4c5efda8d33e582c53a0d7a1d3dfabecaca038bd.tar.gz
emacs-4c5efda8d33e582c53a0d7a1d3dfabecaca038bd.zip
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
-rw-r--r--lisp/proced.el7
-rw-r--r--src/xdisp.c30
2 files changed, 26 insertions, 11 deletions
diff --git a/lisp/proced.el b/lisp/proced.el
index e959e91c6e2..9e9793abece 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1333,11 +1333,12 @@ It is converted to the corresponding attribute key.
1333This command updates the variable `proced-sort'. 1333This command updates the variable `proced-sort'.
1334Prefix ARG controls sort order, see `proced-sort-interactive'." 1334Prefix ARG controls sort order, see `proced-sort-interactive'."
1335 (interactive (list last-input-event (or last-prefix-arg 'no-arg)) proced-mode) 1335 (interactive (list last-input-event (or last-prefix-arg 'no-arg)) proced-mode)
1336 (let ((start (event-start event)) 1336 (let* ((start (event-start event))
1337 col key) 1337 (obj (posn-object start))
1338 col key)
1338 (save-selected-window 1339 (save-selected-window
1339 (select-window (posn-window start)) 1340 (select-window (posn-window start))
1340 (setq col (+ (1- (car (posn-actual-col-row start))) 1341 (setq col (+ (if obj (cdr obj) (posn-point start))
1341 (window-hscroll))) 1342 (window-hscroll)))
1342 (when (and (<= 0 col) (< col (length proced-header-line))) 1343 (when (and (<= 0 col) (< col (length proced-header-line)))
1343 (setq key (get-text-property col 'proced-key proced-header-line)) 1344 (setq key (get-text-property col 'proced-key proced-header-line))
diff --git a/src/xdisp.c b/src/xdisp.c
index 259d057adb1..f6aa7fe3d0c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -30017,7 +30017,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
30017#endif /* HAVE_WINDOW_SYSTEM */ 30017#endif /* HAVE_WINDOW_SYSTEM */
30018 30018
30019/* Produce a stretch glyph for iterator IT. IT->object is the value 30019/* Produce a stretch glyph for iterator IT. IT->object is the value
30020 of the glyph property displayed. The value must be a list 30020 of the display property. The value must be a list of the form
30021 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs 30021 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs
30022 being recognized: 30022 being recognized:
30023 30023
@@ -30027,7 +30027,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
30027 30027
30028 2. `:relative-width FACTOR' specifies that the width of the stretch 30028 2. `:relative-width FACTOR' specifies that the width of the stretch
30029 should be computed from the width of the first character having the 30029 should be computed from the width of the first character having the
30030 `glyph' property, and should be FACTOR times that width. 30030 `display' property, and should be FACTOR times that width.
30031 30031
30032 3. `:align-to HPOS' specifies that the space should be wide enough 30032 3. `:align-to HPOS' specifies that the space should be wide enough
30033 to reach HPOS, a value in canonical character units. 30033 to reach HPOS, a value in canonical character units.
@@ -30039,7 +30039,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
30039 30039
30040 5. `:relative-height FACTOR' specifies that the height of the 30040 5. `:relative-height FACTOR' specifies that the height of the
30041 stretch should be FACTOR times the height of the characters having 30041 stretch should be FACTOR times the height of the characters having
30042 the glyph property. 30042 the display property.
30043 30043
30044 Either none or exactly one of 4 or 5 must be present. 30044 Either none or exactly one of 4 or 5 must be present.
30045 30045
@@ -30060,10 +30060,11 @@ produce_stretch_glyph (struct it *it)
30060#ifdef HAVE_WINDOW_SYSTEM 30060#ifdef HAVE_WINDOW_SYSTEM
30061 int ascent = 0; 30061 int ascent = 0;
30062 bool zero_height_ok_p = false; 30062 bool zero_height_ok_p = false;
30063 struct face *face;
30063 30064
30064 if (FRAME_WINDOW_P (it->f)) 30065 if (FRAME_WINDOW_P (it->f))
30065 { 30066 {
30066 struct face *face = FACE_FROM_ID (it->f, it->face_id); 30067 face = FACE_FROM_ID (it->f, it->face_id);
30067 font = face->font ? face->font : FRAME_FONT (it->f); 30068 font = face->font ? face->font : FRAME_FONT (it->f);
30068 prepare_face_for_display (it->f, face); 30069 prepare_face_for_display (it->f, face);
30069 } 30070 }
@@ -30084,14 +30085,27 @@ produce_stretch_glyph (struct it *it)
30084 else if (prop = Fplist_get (plist, QCrelative_width), NUMVAL (prop) > 0) 30085 else if (prop = Fplist_get (plist, QCrelative_width), NUMVAL (prop) > 0)
30085 { 30086 {
30086 /* Relative width `:relative-width FACTOR' specified and valid. 30087 /* Relative width `:relative-width FACTOR' specified and valid.
30087 Compute the width of the characters having the `glyph' 30088 Compute the width of the characters having this `display'
30088 property. */ 30089 property. */
30089 struct it it2; 30090 struct it it2;
30090 unsigned char *p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); 30091 Lisp_Object object = it->stack[it->sp - 1].string;
30092 unsigned char *p = (STRINGP (object)
30093 ? SDATA (object) + IT_STRING_BYTEPOS (*it)
30094 : BYTE_POS_ADDR (IT_BYTEPOS (*it)));
30095 bool multibyte_p =
30096 STRINGP (object) ? STRING_MULTIBYTE (object) : it->multibyte_p;
30091 30097
30092 it2 = *it; 30098 it2 = *it;
30093 if (it->multibyte_p) 30099 if (multibyte_p)
30094 it2.c = it2.char_to_display = string_char_and_length (p, &it2.len); 30100 {
30101 it2.c = it2.char_to_display = string_char_and_length (p, &it2.len);
30102#ifdef HAVE_WINDOW_SYSTEM
30103 if (FRAME_WINDOW_P (it->f) && ! ASCII_CHAR_P (it2.c))
30104 it2.face_id = FACE_FOR_CHAR (it->f, face, it2.c,
30105 IT_CHARPOS (*it),
30106 STRINGP (object)? object : Qnil);
30107#endif
30108 }
30095 else 30109 else
30096 { 30110 {
30097 it2.c = it2.char_to_display = *p, it2.len = 1; 30111 it2.c = it2.char_to_display = *p, it2.len = 1;