diff options
| author | Eli Zaretskii | 2015-09-22 19:33:47 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2015-09-22 19:33:47 +0300 |
| commit | 62831e7c3ff97c00474d2fcf41866d45afb3a153 (patch) | |
| tree | 28c4323cc13c2316869d96b355f0b69d08482540 /src | |
| parent | e5947fee046a8374fc23714f06cbfbec79d0d2cb (diff) | |
| download | emacs-62831e7c3ff97c00474d2fcf41866d45afb3a153.tar.gz emacs-62831e7c3ff97c00474d2fcf41866d45afb3a153.zip | |
Fix 'current-column' in presence of :relative-width
* src/indent.c (check_display_width): Support ':relative-width'
in a display spec that specifies a stretch glyph. (Bug#21533)
Diffstat (limited to 'src')
| -rw-r--r-- | src/indent.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/indent.c b/src/indent.c index ded18439fd9..584f2179bc5 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -485,7 +485,9 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) | |||
| 485 | : MOST_POSITIVE_FIXNUM); | 485 | : MOST_POSITIVE_FIXNUM); |
| 486 | 486 | ||
| 487 | if ((prop = Fplist_get (plist, QCwidth), | 487 | if ((prop = Fplist_get (plist, QCwidth), |
| 488 | RANGED_INTEGERP (0, prop, INT_MAX))) | 488 | RANGED_INTEGERP (0, prop, INT_MAX)) |
| 489 | || (prop = Fplist_get (plist, QCrelative_width), | ||
| 490 | RANGED_INTEGERP (0, prop, INT_MAX))) | ||
| 489 | width = XINT (prop); | 491 | width = XINT (prop); |
| 490 | else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) | 492 | else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) |
| 491 | && XFLOAT_DATA (prop) <= INT_MAX) | 493 | && XFLOAT_DATA (prop) <= INT_MAX) |
| @@ -504,6 +506,18 @@ check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) | |||
| 504 | *endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); | 506 | *endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 505 | else | 507 | else |
| 506 | get_property_and_range (pos, Qdisplay, &val, &start, endpos, Qnil); | 508 | get_property_and_range (pos, Qdisplay, &val, &start, endpos, Qnil); |
| 509 | |||
| 510 | /* For :relative-width, we need to multiply by the column | ||
| 511 | width of the character at POS, if it is greater than 1. */ | ||
| 512 | if (!NILP (Fplist_get (plist, QCrelative_width)) | ||
| 513 | && !NILP (BVAR (current_buffer, enable_multibyte_characters))) | ||
| 514 | { | ||
| 515 | int b, wd; | ||
| 516 | unsigned char *p = BYTE_POS_ADDR (CHAR_TO_BYTE (pos)); | ||
| 517 | |||
| 518 | MULTIBYTE_BYTES_WIDTH (p, buffer_display_table (), b, wd); | ||
| 519 | width *= wd; | ||
| 520 | } | ||
| 507 | return width; | 521 | return width; |
| 508 | } | 522 | } |
| 509 | } | 523 | } |