aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog19
-rw-r--r--src/dispextern.h3
-rw-r--r--src/image.c3
-rw-r--r--src/syntax.c5
-rw-r--r--src/term.c86
-rw-r--r--src/xdisp.c110
6 files changed, 110 insertions, 116 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ceed28a7a7f..52ec796d6cf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,22 @@
12011-08-30 Chong Yidong <cyd@stupidchicken.com>
2
3 * syntax.c (find_defun_start): Update all cache variables if
4 exiting early (Bug#9401).
5
62011-08-30 Eli Zaretskii <eliz@gnu.org>
7
8 * image.c (x_bitmap_pixmap): Cast to int to avoid compiler warnings.
9
10 * xdisp.c (produce_stretch_glyph): No longer static, compiled also
11 when HAVE_WINDOW_SYSTEM is not defined. Support both GUI and TTY
12 frames. Call tty_append_glyph in the TTY case. (Bug#9402)
13
14 * term.c (tty_append_glyph): New function.
15 (produce_stretch_glyph): Static function and its prototype deleted.
16
17 * dispextern.h (produce_stretch_glyph, tty_append_glyph): Add
18 prototypes.
19
12011-08-29 Paul Eggert <eggert@cs.ucla.edu> 202011-08-29 Paul Eggert <eggert@cs.ucla.edu>
2 21
3 * image.c (parse_image_spec): Check for nonnegative, not for positive, 22 * image.c (parse_image_spec): Check for nonnegative, not for positive,
diff --git a/src/dispextern.h b/src/dispextern.h
index 641391b8c9c..1b2df45086c 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3071,6 +3071,8 @@ extern EMACS_INT compute_display_string_pos (struct text_pos *,
3071 int, int *); 3071 int, int *);
3072extern EMACS_INT compute_display_string_end (EMACS_INT, 3072extern EMACS_INT compute_display_string_end (EMACS_INT,
3073 struct bidi_string_data *); 3073 struct bidi_string_data *);
3074extern void produce_stretch_glyph (struct it *);
3075
3074 3076
3075#ifdef HAVE_WINDOW_SYSTEM 3077#ifdef HAVE_WINDOW_SYSTEM
3076 3078
@@ -3365,6 +3367,7 @@ extern struct terminal *get_named_tty (const char *);
3365EXFUN (Ftty_type, 1); 3367EXFUN (Ftty_type, 1);
3366extern void create_tty_output (struct frame *); 3368extern void create_tty_output (struct frame *);
3367extern struct terminal *init_tty (const char *, const char *, int); 3369extern struct terminal *init_tty (const char *, const char *, int);
3370extern void tty_append_glyph (struct it *);
3368 3371
3369 3372
3370/* Defined in scroll.c */ 3373/* Defined in scroll.c */
diff --git a/src/image.c b/src/image.c
index d6bfc4050ca..c5dcbb32e5d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -196,7 +196,8 @@ x_bitmap_width (FRAME_PTR f, ptrdiff_t id)
196int 196int
197x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id) 197x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id)
198{ 198{
199 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; 199 /* HAVE_NTGUI needs the explicit cast here. */
200 return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
200} 201}
201#endif 202#endif
202 203
diff --git a/src/syntax.c b/src/syntax.c
index 8c2d5ded21f..3e51099794b 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -398,7 +398,12 @@ find_defun_start (EMACS_INT pos, EMACS_INT pos_byte)
398 398
399 if (!open_paren_in_column_0_is_defun_start) 399 if (!open_paren_in_column_0_is_defun_start)
400 { 400 {
401 find_start_value = BEGV;
401 find_start_value_byte = BEGV_BYTE; 402 find_start_value_byte = BEGV_BYTE;
403 find_start_buffer = current_buffer;
404 find_start_modiff = MODIFF;
405 find_start_begv = BEGV;
406 find_start_pos = pos;
402 return BEGV; 407 return BEGV;
403 } 408 }
404 409
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 ***********************************************************************/
1442static void append_glyph (struct it *); 1442static void append_glyph (struct it *);
1443static void produce_stretch_glyph (struct it *);
1444static void append_composite_glyph (struct it *); 1443static void append_composite_glyph (struct it *);
1445static void produce_composite_glyph (struct it *); 1444static void produce_composite_glyph (struct it *);
1446static void append_glyphless_glyph (struct it *, int, const char *); 1445static 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. */
1515void
1516tty_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
1654static void
1655produce_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
diff --git a/src/xdisp.c b/src/xdisp.c
index 8261291f8cc..7cc49ed76d1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -23314,6 +23314,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
23314 IT_EXPAND_MATRIX_WIDTH (it, area); 23314 IT_EXPAND_MATRIX_WIDTH (it, area);
23315} 23315}
23316 23316
23317#endif /* HAVE_WINDOW_SYSTEM */
23317 23318
23318/* Produce a stretch glyph for iterator IT. IT->object is the value 23319/* Produce a stretch glyph for iterator IT. IT->object is the value
23319 of the glyph property displayed. The value must be a list 23320 of the glyph property displayed. The value must be a list
@@ -23346,19 +23347,28 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
23346 of the stretch should be used for the ascent of the stretch. 23347 of the stretch should be used for the ascent of the stretch.
23347 ASCENT must be in the range 0 <= ASCENT <= 100. */ 23348 ASCENT must be in the range 0 <= ASCENT <= 100. */
23348 23349
23349static void 23350void
23350produce_stretch_glyph (struct it *it) 23351produce_stretch_glyph (struct it *it)
23351{ 23352{
23352 /* (space :width WIDTH :height HEIGHT ...) */ 23353 /* (space :width WIDTH :height HEIGHT ...) */
23353 Lisp_Object prop, plist; 23354 Lisp_Object prop, plist;
23354 int width = 0, height = 0, align_to = -1; 23355 int width = 0, height = 0, align_to = -1;
23355 int zero_width_ok_p = 0, zero_height_ok_p = 0; 23356 int zero_width_ok_p = 0;
23356 int ascent = 0; 23357 int ascent = 0;
23357 double tem; 23358 double tem;
23358 struct face *face = FACE_FROM_ID (it->f, it->face_id); 23359 struct face *face = NULL;
23359 struct font *font = face->font ? face->font : FRAME_FONT (it->f); 23360 struct font *font = NULL;
23360 23361
23361 PREPARE_FACE_FOR_DISPLAY (it->f, face); 23362#ifdef HAVE_WINDOW_SYSTEM
23363 int zero_height_ok_p = 0;
23364
23365 if (FRAME_WINDOW_P (it->f))
23366 {
23367 face = FACE_FROM_ID (it->f, it->face_id);
23368 font = face->font ? face->font : FRAME_FONT (it->f);
23369 PREPARE_FACE_FOR_DISPLAY (it->f, face);
23370 }
23371#endif
23362 23372
23363 /* List should start with `space'. */ 23373 /* List should start with `space'. */
23364 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); 23374 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
@@ -23372,8 +23382,9 @@ produce_stretch_glyph (struct it *it)
23372 zero_width_ok_p = 1; 23382 zero_width_ok_p = 1;
23373 width = (int)tem; 23383 width = (int)tem;
23374 } 23384 }
23375 else if (prop = Fplist_get (plist, QCrelative_width), 23385#ifdef HAVE_WINDOW_SYSTEM
23376 NUMVAL (prop) > 0) 23386 else if (FRAME_WINDOW_P (it->f)
23387 && (prop = Fplist_get (plist, QCrelative_width), NUMVAL (prop) > 0))
23377 { 23388 {
23378 /* Relative width `:relative-width FACTOR' specified and valid. 23389 /* Relative width `:relative-width FACTOR' specified and valid.
23379 Compute the width of the characters having the `glyph' 23390 Compute the width of the characters having the `glyph'
@@ -23396,6 +23407,7 @@ produce_stretch_glyph (struct it *it)
23396 x_produce_glyphs (&it2); 23407 x_produce_glyphs (&it2);
23397 width = NUMVAL (prop) * it2.pixel_width; 23408 width = NUMVAL (prop) * it2.pixel_width;
23398 } 23409 }
23410#endif /* HAVE_WINDOW_SYSTEM */
23399 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop)) 23411 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
23400 && calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to)) 23412 && calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to))
23401 { 23413 {
@@ -23415,33 +23427,40 @@ produce_stretch_glyph (struct it *it)
23415 if (width <= 0 && (width < 0 || !zero_width_ok_p)) 23427 if (width <= 0 && (width < 0 || !zero_width_ok_p))
23416 width = 1; 23428 width = 1;
23417 23429
23430#ifdef HAVE_WINDOW_SYSTEM
23418 /* Compute height. */ 23431 /* Compute height. */
23419 if ((prop = Fplist_get (plist, QCheight), !NILP (prop)) 23432 if (FRAME_WINDOW_P (it->f))
23420 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
23421 { 23433 {
23422 height = (int)tem; 23434 if ((prop = Fplist_get (plist, QCheight), !NILP (prop))
23423 zero_height_ok_p = 1; 23435 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
23424 } 23436 {
23425 else if (prop = Fplist_get (plist, QCrelative_height), 23437 height = (int)tem;
23426 NUMVAL (prop) > 0) 23438 zero_height_ok_p = 1;
23427 height = FONT_HEIGHT (font) * NUMVAL (prop); 23439 }
23428 else 23440 else if (prop = Fplist_get (plist, QCrelative_height),
23429 height = FONT_HEIGHT (font); 23441 NUMVAL (prop) > 0)
23442 height = FONT_HEIGHT (font) * NUMVAL (prop);
23443 else
23444 height = FONT_HEIGHT (font);
23430 23445
23431 if (height <= 0 && (height < 0 || !zero_height_ok_p)) 23446 if (height <= 0 && (height < 0 || !zero_height_ok_p))
23432 height = 1; 23447 height = 1;
23433 23448
23434 /* Compute percentage of height used for ascent. If 23449 /* Compute percentage of height used for ascent. If
23435 `:ascent ASCENT' is present and valid, use that. Otherwise, 23450 `:ascent ASCENT' is present and valid, use that. Otherwise,
23436 derive the ascent from the font in use. */ 23451 derive the ascent from the font in use. */
23437 if (prop = Fplist_get (plist, QCascent), 23452 if (prop = Fplist_get (plist, QCascent),
23438 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) 23453 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100)
23439 ascent = height * NUMVAL (prop) / 100.0; 23454 ascent = height * NUMVAL (prop) / 100.0;
23440 else if (!NILP (prop) 23455 else if (!NILP (prop)
23441 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0)) 23456 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
23442 ascent = min (max (0, (int)tem), height); 23457 ascent = min (max (0, (int)tem), height);
23458 else
23459 ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font);
23460 }
23443 else 23461 else
23444 ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font); 23462#endif /* HAVE_WINDOW_SYSTEM */
23463 height = 1;
23445 23464
23446 if (width > 0 && it->line_wrap != TRUNCATE 23465 if (width > 0 && it->line_wrap != TRUNCATE
23447 && it->current_x + width > it->last_visible_x) 23466 && it->current_x + width > it->last_visible_x)
@@ -23449,20 +23468,37 @@ produce_stretch_glyph (struct it *it)
23449 23468
23450 if (width > 0 && height > 0 && it->glyph_row) 23469 if (width > 0 && height > 0 && it->glyph_row)
23451 { 23470 {
23471 Lisp_Object o_object = it->object;
23452 Lisp_Object object = it->stack[it->sp - 1].string; 23472 Lisp_Object object = it->stack[it->sp - 1].string;
23473 int n = width;
23474
23453 if (!STRINGP (object)) 23475 if (!STRINGP (object))
23454 object = it->w->buffer; 23476 object = it->w->buffer;
23455 append_stretch_glyph (it, object, width, height, ascent); 23477#ifdef HAVE_WINDOW_SYSTEM
23478 if (FRAME_WINDOW_P (it->f))
23479 {
23480 append_stretch_glyph (it, object, width, height, ascent);
23481 it->ascent = it->phys_ascent = ascent;
23482 it->descent = it->phys_descent = height - it->ascent;
23483 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
23484 take_vertical_position_into_account (it);
23485 }
23486 else
23487#endif
23488 {
23489 it->object = object;
23490 it->char_to_display = ' ';
23491 it->pixel_width = it->len = 1;
23492 while (n--)
23493 tty_append_glyph (it);
23494 it->object = o_object;
23495 it->pixel_width = width;
23496 }
23456 } 23497 }
23457
23458 it->pixel_width = width;
23459 it->ascent = it->phys_ascent = ascent;
23460 it->descent = it->phys_descent = height - it->ascent;
23461 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
23462
23463 take_vertical_position_into_account (it);
23464} 23498}
23465 23499
23500#ifdef HAVE_WINDOW_SYSTEM
23501
23466/* Calculate line-height and line-spacing properties. 23502/* Calculate line-height and line-spacing properties.
23467 An integer value specifies explicit pixel value. 23503 An integer value specifies explicit pixel value.
23468 A float value specifies relative value to current face height. 23504 A float value specifies relative value to current face height.