diff options
| author | Eli Zaretskii | 2024-06-20 12:52:06 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-06-20 12:52:06 +0300 |
| commit | 775aeabcfbf84c950610738cd130bf652c77bfa5 (patch) | |
| tree | 47dfa62d256fe3389f6eb205c7d25fc59eee7eee /src | |
| parent | b8affdb7b5760b3681ada9dcba78dd3c07405b61 (diff) | |
| download | emacs-775aeabcfbf84c950610738cd130bf652c77bfa5.tar.gz emacs-775aeabcfbf84c950610738cd130bf652c77bfa5.zip | |
Fix use of ':align-to' in 'wrap-prefix'
* src/dispextern.h (struct it): New flag 'align_visually_p'.
* src/xdisp.c (handle_line_prefix): Set the 'align_visually_p'
flag for 'wrap-prefix'.
(produce_stretch_glyph): If 'align_visually_p' flag is set, count
the :align-to offset from the beginning of the screen line, not
from BOL. (Bug#71605)
* doc/lispref/display.texi (Truncation, Specified Space): Document
the special handling of ':align-to' in 'wrap-prefix'.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispextern.h | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/dispextern.h b/src/dispextern.h index 85012130689..51dc354d37c 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2629,6 +2629,11 @@ struct it | |||
| 2629 | the current row. */ | 2629 | the current row. */ |
| 2630 | bool_bf line_number_produced_p : 1; | 2630 | bool_bf line_number_produced_p : 1; |
| 2631 | 2631 | ||
| 2632 | /* If true, the :align-to argument should be counted relative to the | ||
| 2633 | beginning of the screen line, not the logical line. Used by | ||
| 2634 | 'wrap-prefix'. */ | ||
| 2635 | bool_bf align_visually_p : 1; | ||
| 2636 | |||
| 2632 | enum line_wrap_method line_wrap; | 2637 | enum line_wrap_method line_wrap; |
| 2633 | 2638 | ||
| 2634 | /* The ID of the default face to use. One of DEFAULT_FACE_ID, | 2639 | /* The ID of the default face to use. One of DEFAULT_FACE_ID, |
diff --git a/src/xdisp.c b/src/xdisp.c index 0148cd76ada..5987813cd28 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -24494,6 +24494,11 @@ handle_line_prefix (struct it *it) | |||
| 24494 | prefix = get_line_prefix_it_property (it, Qwrap_prefix); | 24494 | prefix = get_line_prefix_it_property (it, Qwrap_prefix); |
| 24495 | if (NILP (prefix)) | 24495 | if (NILP (prefix)) |
| 24496 | prefix = Vwrap_prefix; | 24496 | prefix = Vwrap_prefix; |
| 24497 | /* Interpreting :align-to relative to the beginning of the logical | ||
| 24498 | line effectively renders this feature unusable, so we make an | ||
| 24499 | exception for this use of :align-to. */ | ||
| 24500 | if (!NILP (prefix)) | ||
| 24501 | it->align_visually_p = true; | ||
| 24497 | } | 24502 | } |
| 24498 | else | 24503 | else |
| 24499 | { | 24504 | { |
| @@ -31972,7 +31977,9 @@ produce_stretch_glyph (struct it *it) | |||
| 31972 | && calc_pixel_width_or_height (&tem, it, prop, font, true, | 31977 | && calc_pixel_width_or_height (&tem, it, prop, font, true, |
| 31973 | &align_to)) | 31978 | &align_to)) |
| 31974 | { | 31979 | { |
| 31975 | int x = it->current_x + it->continuation_lines_width; | 31980 | int x = it->current_x + (it->align_visually_p |
| 31981 | ? 0 | ||
| 31982 | : it->continuation_lines_width); | ||
| 31976 | int x0 = x; | 31983 | int x0 = x; |
| 31977 | /* Adjust for line numbers, if needed. */ | 31984 | /* Adjust for line numbers, if needed. */ |
| 31978 | if (!NILP (Vdisplay_line_numbers) && it->line_number_produced_p) | 31985 | if (!NILP (Vdisplay_line_numbers) && it->line_number_produced_p) |