[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/native-comp e527d1a 4/4: Merge remote-tracking branch 'savannah/
From: |
Andrea Corallo |
Subject: |
feature/native-comp e527d1a 4/4: Merge remote-tracking branch 'savannah/master' into HEAD |
Date: |
Fri, 24 Apr 2020 11:52:34 -0400 (EDT) |
branch: feature/native-comp
commit e527d1ab285e9a6611dc23ea8eae9ae9d8e163bb
Merge: 3ac3ba2 367b559
Author: Andrea Corallo <address@hidden>
Commit: Andrea Corallo <address@hidden>
Merge remote-tracking branch 'savannah/master' into HEAD
---
etc/edt-user.el | 2 +-
lisp/kermit.el | 2 +-
src/.gdbinit | 6 +++---
src/dispextern.h | 2 +-
src/nsterm.m | 17 +++++++++++++--
src/w32term.c | 51 +++++++++++++++++++++++++++++++++-----------
src/xdisp.c | 18 +++++++++++++---
src/xterm.c | 24 +++++++++++++++++----
test/lisp/net/tramp-tests.el | 3 ++-
9 files changed, 96 insertions(+), 29 deletions(-)
diff --git a/etc/edt-user.el b/etc/edt-user.el
index 0ecd818..2852f93 100644
--- a/etc/edt-user.el
+++ b/etc/edt-user.el
@@ -1,4 +1,4 @@
-;;; edt-user.el --- Sample user customizations for Emacs EDT emulation
+;;; edt-user.el --- Sample user customizations for Emacs EDT emulation -*-
lexical-binding: t -*-
;; Copyright (C) 1986, 1992-1993, 2000-2020 Free Software Foundation,
;; Inc.
diff --git a/lisp/kermit.el b/lisp/kermit.el
index b0a4d90..f2607bf 100644
--- a/lisp/kermit.el
+++ b/lisp/kermit.el
@@ -1,4 +1,4 @@
-;;; kermit.el --- additions to shell mode for use with kermit
+;;; kermit.el --- additions to shell mode for use with kermit -*-
lexical-binding: t -*-
;; Copyright (C) 1988, 2001-2020 Free Software Foundation, Inc.
diff --git a/src/.gdbinit b/src/.gdbinit
index 30c7b05..78536fc 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -500,6 +500,9 @@ define pgx
# IMAGE_GLYPH
if ($g.type == 3)
printf "IMAGE[%d]", $g.u.img_id
+ if ($g.slice.img.x || $g.slice.img.y || $g.slice.img.width ||
$g.slice.img.height)
+ printf " slice=%d,%d,%d,%d" ,$g.slice.img.x, $g.slice.img.y,
$g.slice.img.width, $g.slice.img.height
+ end
end
# STRETCH_GLYPH
if ($g.type == 4)
@@ -551,9 +554,6 @@ define pgx
if ($g.right_box_line_p)
printf " ]"
end
- if ($g.slice.img.x || $g.slice.img.y || $g.slice.img.width ||
$g.slice.img.height)
- printf " slice=%d,%d,%d,%d" ,$g.slice.img.x, $g.slice.img.y,
$g.slice.img.width, $g.slice.img.height
- end
printf "\n"
end
document pgx
diff --git a/src/dispextern.h b/src/dispextern.h
index d6fe68c..0b1f3d1 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -369,7 +369,7 @@ enum glyph_type
/* Glyph describes a character. */
CHAR_GLYPH,
- /* Glyph describes a static composition. */
+ /* Glyph describes a static or automatic composition. */
COMPOSITE_GLYPH,
/* Glyph describes a glyphless character. */
diff --git a/src/nsterm.m b/src/nsterm.m
index 5eb4463..a8f7540 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -3872,8 +3872,21 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s)
last_x = ((s->row->full_width_p && !s->w->pseudo_window_p)
? WINDOW_RIGHT_EDGE_X (s->w)
: window_box_right (s->w, s->area));
- last_glyph = (s->cmp || s->img
- ? s->first_glyph : s->first_glyph + s->nchars-1);
+ if (s->cmp || s->img)
+ last_glyph = s->first_glyph;
+ else if (s->first_glyph->type == COMPOSITE_GLYPH
+ && s->first_glyph->u.cmp.automatic)
+ {
+ struct glyph *end = s->row->glyphs[s->area] + s->row->used[s->area];
+ struct glyph *g = s->first_glyph;
+ for (last_glyph = g++;
+ g < end && g->u.cmp.automatic && g->u.cmp.id == s->cmp_id
+ && g->slice.cmp.to < s->cmp_to;
+ last_glyph = g++)
+ ;
+ }
+ else
+ last_glyph = s->first_glyph + s->nchars - 1;
right_x = ((s->row->full_width_p && s->extends_to_end_of_line_p
? last_x - 1 : min (last_x, s->x + s->background_width) - 1));
diff --git a/src/w32term.c b/src/w32term.c
index 108cb79..1766b32 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1101,19 +1101,28 @@ w32_set_glyph_string_clipping_exactly (struct
glyph_string *src,
static void
w32_compute_glyph_string_overhangs (struct glyph_string *s)
{
- if (s->cmp == NULL
- && s->first_glyph->type == CHAR_GLYPH
- && !s->font_not_found_p)
+ if (s->cmp == NULL)
{
- struct font *font = s->font;
struct font_metrics metrics;
+ if (s->first_glyph->type == CHAR_GLYPH && !s->font_not_found_p)
+ {
+ struct font *font = s->font;
+ font->driver->text_extents (font, s->char2b, s->nchars, &metrics);
+ s->right_overhang = (metrics.rbearing > metrics.width
+ ? metrics.rbearing - metrics.width : 0);
+ s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0;
+ }
+ else if (s->first_glyph->type == COMPOSITE_GLYPH)
+ {
+ Lisp_Object gstring = composition_gstring_from_id (s->cmp_id);
- font->driver->text_extents (font, s->char2b, s->nchars, &metrics);
- s->right_overhang = (metrics.rbearing > metrics.width
- ? metrics.rbearing - metrics.width : 0);
- s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0;
+ composition_gstring_width (gstring, s->cmp_from, s->cmp_to, &metrics);
+ s->right_overhang = (metrics.rbearing > metrics.width
+ ? metrics.rbearing - metrics.width : 0);
+ s->left_overhang = metrics.lbearing < 0 ? -metrics.lbearing : 0;
+ }
}
- else if (s->cmp)
+ else
{
s->right_overhang = s->cmp->rbearing - s->cmp->pixel_width;
s->left_overhang = -s->cmp->lbearing;
@@ -1725,10 +1734,26 @@ w32_draw_glyph_string_box (struct glyph_string *s)
? WINDOW_RIGHT_EDGE_X (s->w)
: window_box_right (s->w, s->area));
- /* The glyph that may have a right box line. */
- last_glyph = (s->cmp || s->img
- ? s->first_glyph
- : s->first_glyph + s->nchars - 1);
+ /* The glyph that may have a right box line. For static
+ compositions and images, the right-box flag is on the first glyph
+ of the glyph string; for other types it's on the last glyph. */
+ if (s->cmp || s->img)
+ last_glyph = s->first_glyph;
+ else if (s->first_glyph->type == COMPOSITE_GLYPH
+ && s->first_glyph->u.cmp.automatic)
+ {
+ /* For automatic compositions, we need to look up the last glyph
+ in the composition. */
+ struct glyph *end = s->row->glyphs[s->area] + s->row->used[s->area];
+ struct glyph *g = s->first_glyph;
+ for (last_glyph = g++;
+ g < end && g->u.cmp.automatic && g->u.cmp.id == s->cmp_id
+ && g->slice.cmp.to < s->cmp_to;
+ last_glyph = g++)
+ ;
+ }
+ else
+ last_glyph = s->first_glyph + s->nchars - 1;
vwidth = eabs (s->face->box_vertical_line_width);
hwidth = eabs (s->face->box_horizontal_line_width);
diff --git a/src/xdisp.c b/src/xdisp.c
index 01f2720..3258893 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -7617,7 +7617,13 @@ get_next_display_element (struct it *it)
/* Otherwise, the box comes from the underlying face.
If this is the last string character displayed, check
the next buffer location. */
- else if ((IT_STRING_CHARPOS (*it) >= SCHARS (it->string) - 1)
+ else if (((IT_STRING_CHARPOS (*it) >= SCHARS (it->string) - 1)
+ /* For a composition, see if the string ends
+ at the last character included in the
+ composition. */
+ || (it->what == IT_COMPOSITION
+ && (IT_STRING_CHARPOS (*it) + it->cmp_it.nchars
+ >= SCHARS (it->string))))
/* n_overlay_strings is unreliable unless
overlay_string_index is non-negative. */
&& ((it->current.overlay_string_index >= 0
@@ -27567,12 +27573,18 @@ fill_gstring_glyph_string (struct glyph_string *s,
int face_id,
s->face = FACE_FROM_ID (s->f, face_id);
lgstring = composition_gstring_from_id (s->cmp_id);
s->font = XFONT_OBJECT (LGSTRING_FONT (lgstring));
+ /* The width of a composition glyph string is the sum of the
+ composition's glyph widths. */
+ s->width = s->first_glyph->pixel_width;
glyph++;
while (glyph < last
&& glyph->u.cmp.automatic
&& glyph->u.cmp.id == s->cmp_id
&& s->cmp_to == glyph->slice.cmp.from)
- s->cmp_to = (glyph++)->slice.cmp.to + 1;
+ {
+ s->width += glyph->pixel_width;
+ s->cmp_to = (glyph++)->slice.cmp.to + 1;
+ }
for (i = s->cmp_from; i < s->cmp_to; i++)
{
@@ -27582,7 +27594,7 @@ fill_gstring_glyph_string (struct glyph_string *s, int
face_id,
/* Ensure that the code is only 2 bytes wide. */
s->char2b[i] = code & 0xFFFF;
}
- s->width = composition_gstring_width (lgstring, s->cmp_from, s->cmp_to,
NULL);
+
return glyph - s->row->glyphs[s->area];
}
diff --git a/src/xterm.c b/src/xterm.c
index afe9c3d..7989cec 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2986,10 +2986,26 @@ x_draw_glyph_string_box (struct glyph_string *s)
? WINDOW_RIGHT_EDGE_X (s->w)
: window_box_right (s->w, s->area));
- /* The glyph that may have a right box line. */
- last_glyph = (s->cmp || s->img
- ? s->first_glyph
- : s->first_glyph + s->nchars - 1);
+ /* The glyph that may have a right box line. For static
+ compositions and images, the right-box flag is on the first glyph
+ of the glyph string; for other types it's on the last glyph. */
+ if (s->cmp || s->img)
+ last_glyph = s->first_glyph;
+ else if (s->first_glyph->type == COMPOSITE_GLYPH
+ && s->first_glyph->u.cmp.automatic)
+ {
+ /* For automatic compositions, we need to look up the last glyph
+ in the composition. */
+ struct glyph *end = s->row->glyphs[s->area] + s->row->used[s->area];
+ struct glyph *g = s->first_glyph;
+ for (last_glyph = g++;
+ g < end && g->u.cmp.automatic && g->u.cmp.id == s->cmp_id
+ && g->slice.cmp.to < s->cmp_to;
+ last_glyph = g++)
+ ;
+ }
+ else
+ last_glyph = s->first_glyph + s->nchars - 1;
vwidth = eabs (s->face->box_vertical_line_width);
hwidth = eabs (s->face->box_horizontal_line_width);
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 4966825..d00c88a 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -4642,7 +4642,8 @@ INPUT, if non-nil, is a string sent to the process."
;; This test is inspired by Bug#39067.
(ert-deftest tramp-test32-shell-command-dont-erase-buffer ()
"Check `shell-command-dont-erase-buffer'."
- :tags '(:expensive-test)
+ ;; The test fails due to recent changes in Emacs. So we mark it as unstable.
+ :tags '(:expensive-test :unstable)
(skip-unless (tramp--test-enabled))
(skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
;; Prior Emacs 27, `shell-command-dont-erase-buffer' wasn't working properly.