diff options
| author | Eli Zaretskii | 2014-07-29 11:19:29 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-07-29 11:19:29 +0300 |
| commit | 64ae6e0100fab05b0ceb9bded6d834208eeb3e8f (patch) | |
| tree | 50e1359eaf21ea2b3e1d4e9f273d47cc863fce8b /src | |
| parent | aac90c4a9c760ca12395783c7c4120427ba32a96 (diff) | |
| download | emacs-64ae6e0100fab05b0ceb9bded6d834208eeb3e8f.tar.gz emacs-64ae6e0100fab05b0ceb9bded6d834208eeb3e8f.zip | |
Fix hscroll of R2L lines that begin with a TAB or another wide glyph.
src/xdisp.c (append_stretch_glyph): In a R2L glyph row, decrease the
pixel width of the first glyph that is hscrolled from display.
(display_line): In R2L glyph rows, don't give a negative offset to
row->x when the first glyph begins before first_visible_x.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/xdisp.c | 33 |
2 files changed, 38 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a86b695e147..9d5e7687110 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-07-29 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | Fix hscroll of R2L lines that begin with a TAB or another wide glyph. | ||
| 4 | * xdisp.c (append_stretch_glyph): In a R2L glyph row, decrease the | ||
| 5 | pixel width of the first glyph that is hscrolled from display. | ||
| 6 | (display_line): In R2L glyph rows, don't give a negative offset to | ||
| 7 | row->x when the first glyph begins before first_visible_x. | ||
| 8 | |||
| 1 | 2014-07-29 Andreas Schwab <schwab@suse.de> | 9 | 2014-07-29 Andreas Schwab <schwab@suse.de> |
| 2 | 10 | ||
| 3 | * macros.c (Fstart_kbd_macro): Initialize kbd_macro_ptr and | 11 | * macros.c (Fstart_kbd_macro): Initialize kbd_macro_ptr and |
diff --git a/src/xdisp.c b/src/xdisp.c index 5cd90136ee6..e9e8ad6594e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20188,7 +20188,12 @@ display_line (struct it *it) | |||
| 20188 | it->max_phys_ascent + it->max_phys_descent); | 20188 | it->max_phys_ascent + it->max_phys_descent); |
| 20189 | row->extra_line_spacing = max (row->extra_line_spacing, | 20189 | row->extra_line_spacing = max (row->extra_line_spacing, |
| 20190 | it->max_extra_line_spacing); | 20190 | it->max_extra_line_spacing); |
| 20191 | if (it->current_x - it->pixel_width < it->first_visible_x) | 20191 | if (it->current_x - it->pixel_width < it->first_visible_x |
| 20192 | /* In R2L rows, we arrange in extend_face_to_end_of_line | ||
| 20193 | to add a right offset to the line, by a suitable | ||
| 20194 | change to the stretch glyph that is the leftmost | ||
| 20195 | glyph of the line. */ | ||
| 20196 | && !row->reversed_p) | ||
| 20192 | row->x = x - it->first_visible_x; | 20197 | row->x = x - it->first_visible_x; |
| 20193 | /* Record the maximum and minimum buffer positions seen so | 20198 | /* Record the maximum and minimum buffer positions seen so |
| 20194 | far in glyphs that will be displayed by this row. */ | 20199 | far in glyphs that will be displayed by this row. */ |
| @@ -20402,9 +20407,13 @@ display_line (struct it *it) | |||
| 20402 | if (it->bidi_p) | 20407 | if (it->bidi_p) |
| 20403 | RECORD_MAX_MIN_POS (it); | 20408 | RECORD_MAX_MIN_POS (it); |
| 20404 | 20409 | ||
| 20405 | if (x < it->first_visible_x) | 20410 | if (x < it->first_visible_x && !row->reversed_p) |
| 20406 | /* Glyph is partially visible, i.e. row starts at | 20411 | /* Glyph is partially visible, i.e. row starts at |
| 20407 | negative X position. */ | 20412 | negative X position. Don't do that in R2L |
| 20413 | rows, where we arrange to add a right offset to | ||
| 20414 | the line in extend_face_to_end_of_line, by a | ||
| 20415 | suitable change to the stretch glyph that is | ||
| 20416 | the leftmost glyph of the line. */ | ||
| 20408 | row->x = x - it->first_visible_x; | 20417 | row->x = x - it->first_visible_x; |
| 20409 | } | 20418 | } |
| 20410 | else | 20419 | else |
| @@ -25295,6 +25304,24 @@ append_stretch_glyph (struct it *it, Lisp_Object object, | |||
| 25295 | for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--) | 25304 | for (g = glyph - 1; g >= it->glyph_row->glyphs[area]; g--) |
| 25296 | g[1] = *g; | 25305 | g[1] = *g; |
| 25297 | glyph = it->glyph_row->glyphs[area]; | 25306 | glyph = it->glyph_row->glyphs[area]; |
| 25307 | |||
| 25308 | /* Decrease the width of the first glyph of the row that | ||
| 25309 | begins before first_visible_x (e.g., due to hscroll). | ||
| 25310 | This is so the overall width of the row becomes smaller | ||
| 25311 | by the scroll amount, and the stretch glyph appended by | ||
| 25312 | extend_face_to_end_of_line will be wider, to shift the | ||
| 25313 | row glyphs to the right. (In L2R rows, the corresponding | ||
| 25314 | left-shift effect is accomplished by setting row->x to a | ||
| 25315 | negative value, which won't work with R2L rows.) | ||
| 25316 | |||
| 25317 | This must leave us with a positive value of WIDTH, since | ||
| 25318 | otherwise the call to move_it_in_display_line_to at the | ||
| 25319 | beginning of display_line would have got past the entire | ||
| 25320 | first glyph, and then it->current_x would have been | ||
| 25321 | greater or equal to it->first_visible_x. */ | ||
| 25322 | if (it->current_x < it->first_visible_x) | ||
| 25323 | width -= it->first_visible_x - it->current_x; | ||
| 25324 | eassert (width > 0); | ||
| 25298 | } | 25325 | } |
| 25299 | glyph->charpos = CHARPOS (it->position); | 25326 | glyph->charpos = CHARPOS (it->position); |
| 25300 | glyph->object = object; | 25327 | glyph->object = object; |