diff options
| author | Eli Zaretskii | 2011-08-30 20:32:44 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2011-08-30 20:32:44 +0300 |
| commit | 148ae00e30c1b6132f3a237ce1d4ddd25094ab6b (patch) | |
| tree | 0d5bfeea5a727819da6217a37a4a044c7b6afc1e /src/term.c | |
| parent | 015faae4f82a89f8882352a87b68eb2ea4b5c703 (diff) | |
| download | emacs-148ae00e30c1b6132f3a237ce1d4ddd25094ab6b.tar.gz emacs-148ae00e30c1b6132f3a237ce1d4ddd25094ab6b.zip | |
Fix bug #9402 with :align-to on TTY frames.
src/xdisp.c (produce_stretch_glyph): No longer static, compiled also
when HAVE_WINDOW_SYSTEM is not defined. Support both GUI and TTY
frames. Call tty_append_glyph in the TTY case. (Bug#9402)
src/term.c (tty_append_glyph): New function.
(produce_stretch_glyph): Static function and its prototype deleted.
src/dispextern.h (produce_stretch_glyph, tty_append_glyph): Add
prototypes.
Diffstat (limited to 'src/term.c')
| -rw-r--r-- | src/term.c | 86 |
1 files changed, 8 insertions, 78 deletions
diff --git a/src/term.c b/src/term.c index 8672a2417c8..837ab399152 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1440,7 +1440,6 @@ term_get_fkeys_1 (void) | |||
| 1440 | Character Display Information | 1440 | Character Display Information |
| 1441 | ***********************************************************************/ | 1441 | ***********************************************************************/ |
| 1442 | static void append_glyph (struct it *); | 1442 | static void append_glyph (struct it *); |
| 1443 | static void produce_stretch_glyph (struct it *); | ||
| 1444 | static void append_composite_glyph (struct it *); | 1443 | static void append_composite_glyph (struct it *); |
| 1445 | static void produce_composite_glyph (struct it *); | 1444 | static void produce_composite_glyph (struct it *); |
| 1446 | static void append_glyphless_glyph (struct it *, int, const char *); | 1445 | static void append_glyphless_glyph (struct it *, int, const char *); |
| @@ -1512,6 +1511,14 @@ append_glyph (struct it *it) | |||
| 1512 | } | 1511 | } |
| 1513 | } | 1512 | } |
| 1514 | 1513 | ||
| 1514 | /* For external use. */ | ||
| 1515 | void | ||
| 1516 | tty_append_glyph (struct it *it) | ||
| 1517 | { | ||
| 1518 | append_glyph (it); | ||
| 1519 | } | ||
| 1520 | |||
| 1521 | |||
| 1515 | /* Produce glyphs for the display element described by IT. *IT | 1522 | /* Produce glyphs for the display element described by IT. *IT |
| 1516 | specifies what we want to produce a glyph for (character, image, ...), | 1523 | specifies what we want to produce a glyph for (character, image, ...), |
| 1517 | and where in the glyph matrix we currently are (glyph row and hpos). | 1524 | and where in the glyph matrix we currently are (glyph row and hpos). |
| @@ -1638,83 +1645,6 @@ produce_glyphs (struct it *it) | |||
| 1638 | it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1; | 1645 | it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1; |
| 1639 | } | 1646 | } |
| 1640 | 1647 | ||
| 1641 | |||
| 1642 | /* Produce a stretch glyph for iterator IT. IT->object is the value | ||
| 1643 | of the glyph property displayed. The value must be a list | ||
| 1644 | `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs | ||
| 1645 | being recognized: | ||
| 1646 | |||
| 1647 | 1. `:width WIDTH' specifies that the space should be WIDTH * | ||
| 1648 | canonical char width wide. WIDTH may be an integer or floating | ||
| 1649 | point number. | ||
| 1650 | |||
| 1651 | 2. `:align-to HPOS' specifies that the space should be wide enough | ||
| 1652 | to reach HPOS, a value in canonical character units. */ | ||
| 1653 | |||
| 1654 | static void | ||
| 1655 | produce_stretch_glyph (struct it *it) | ||
| 1656 | { | ||
| 1657 | /* (space :width WIDTH ...) */ | ||
| 1658 | Lisp_Object prop, plist; | ||
| 1659 | int width = 0, align_to = -1; | ||
| 1660 | int zero_width_ok_p = 0; | ||
| 1661 | double tem; | ||
| 1662 | |||
| 1663 | /* List should start with `space'. */ | ||
| 1664 | xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); | ||
| 1665 | plist = XCDR (it->object); | ||
| 1666 | |||
| 1667 | /* Compute the width of the stretch. */ | ||
| 1668 | if ((prop = Fplist_get (plist, QCwidth), !NILP (prop)) | ||
| 1669 | && calc_pixel_width_or_height (&tem, it, prop, 0, 1, 0)) | ||
| 1670 | { | ||
| 1671 | /* Absolute width `:width WIDTH' specified and valid. */ | ||
| 1672 | zero_width_ok_p = 1; | ||
| 1673 | width = (int)(tem + 0.5); | ||
| 1674 | } | ||
| 1675 | else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop)) | ||
| 1676 | && calc_pixel_width_or_height (&tem, it, prop, 0, 1, &align_to)) | ||
| 1677 | { | ||
| 1678 | if (it->glyph_row == NULL || !it->glyph_row->mode_line_p) | ||
| 1679 | align_to = (align_to < 0 | ||
| 1680 | ? 0 | ||
| 1681 | : align_to - window_box_left_offset (it->w, TEXT_AREA)); | ||
| 1682 | else if (align_to < 0) | ||
| 1683 | align_to = window_box_left_offset (it->w, TEXT_AREA); | ||
| 1684 | width = max (0, (int)(tem + 0.5) + align_to - it->current_x); | ||
| 1685 | zero_width_ok_p = 1; | ||
| 1686 | } | ||
| 1687 | else | ||
| 1688 | /* Nothing specified -> width defaults to canonical char width. */ | ||
| 1689 | width = FRAME_COLUMN_WIDTH (it->f); | ||
| 1690 | |||
| 1691 | if (width <= 0 && (width < 0 || !zero_width_ok_p)) | ||
| 1692 | width = 1; | ||
| 1693 | |||
| 1694 | if (width > 0 && it->line_wrap != TRUNCATE | ||
| 1695 | && it->current_x + width > it->last_visible_x) | ||
| 1696 | width = it->last_visible_x - it->current_x - 1; | ||
| 1697 | |||
| 1698 | if (width > 0 && it->glyph_row) | ||
| 1699 | { | ||
| 1700 | Lisp_Object o_object = it->object; | ||
| 1701 | Lisp_Object object = it->stack[it->sp - 1].string; | ||
| 1702 | int n = width; | ||
| 1703 | |||
| 1704 | if (!STRINGP (object)) | ||
| 1705 | object = it->w->buffer; | ||
| 1706 | it->object = object; | ||
| 1707 | it->char_to_display = ' '; | ||
| 1708 | it->pixel_width = it->len = 1; | ||
| 1709 | while (n--) | ||
| 1710 | append_glyph (it); | ||
| 1711 | it->object = o_object; | ||
| 1712 | } | ||
| 1713 | it->pixel_width = width; | ||
| 1714 | it->nglyphs = width; | ||
| 1715 | } | ||
| 1716 | |||
| 1717 | |||
| 1718 | /* Append glyphs to IT's glyph_row for the composition IT->cmp_id. | 1648 | /* Append glyphs to IT's glyph_row for the composition IT->cmp_id. |
| 1719 | Called from produce_composite_glyph for terminal frames if | 1649 | Called from produce_composite_glyph for terminal frames if |
| 1720 | IT->glyph_row != NULL. IT->face_id contains the character's | 1650 | IT->glyph_row != NULL. IT->face_id contains the character's |