aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-04-20 16:08:35 +0300
committerEli Zaretskii2010-04-20 16:08:35 +0300
commit93d68d0c2b085f65a867024fb8e7e28a629a003a (patch)
treea21bf950974796a985a8e176958de602c4b75ee5 /src
parent43a03da53d3f6bc82813e070e506b0fc367456a4 (diff)
downloademacs-93d68d0c2b085f65a867024fb8e7e28a629a003a.tar.gz
emacs-93d68d0c2b085f65a867024fb8e7e28a629a003a.zip
Fix R2L paragraph display on TTY.
xdisp.c (unproduce_glyphs): New function. (display_line): Use it when produced glyphs are discarded from R2L glyph rows. (append_composite_glyph): In R2L rows, prepend the glyph rather than appending it. term.c (append_composite_glyph): In R2L rows, prepend the glyph rather than append it. Set up the resolved_level and bidi_type attributes of the appended glyph.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog18
-rw-r--r--src/term.c24
-rw-r--r--src/xdisp.c67
3 files changed, 102 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7f081d9563f..9a83f0c8bc7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,21 @@
12010-04-20 Eli Zaretskii <eliz@gnu.org>
2
3 Fix R2L paragraph display on TTY.
4
5 * xdisp.c (unproduce_glyphs): New function.
6 (display_line): Use it when produced glyphs are discarded from R2L
7 glyph rows.
8 (append_composite_glyph): In R2L rows, prepend the glyph rather
9 than appending it.
10
11 * term.c (append_composite_glyph): In R2L rows, prepend the glyph
12 rather than append it. Set up the resolved_level and bidi_type
13 attributes of the appended glyph.
14
12010-04-17 Eli Zaretskii <eliz@gnu.org> 152010-04-17 Eli Zaretskii <eliz@gnu.org>
2 16
17 Continue work on R2L paragraphs in GUI sessions.
18
3 * xdisp.c (extend_face_to_end_of_line): Fix off-by-one error on 19 * xdisp.c (extend_face_to_end_of_line): Fix off-by-one error on
4 TTY frames in testing whether a line needs face extension. 20 TTY frames in testing whether a line needs face extension.
5 21
@@ -22,8 +38,6 @@
22 which happens with R2L glyph rows. Fixes a crash when inserting a 38 which happens with R2L glyph rows. Fixes a crash when inserting a
23 character at end of an R2L line. 39 character at end of an R2L line.
24 40
25 Continue work on R2L paragraphs in GUI sessions.
26
27 * xdisp.c (set_cursor_from_row): Don't be fooled by truncated 41 * xdisp.c (set_cursor_from_row): Don't be fooled by truncated
28 rows: don't treat them as having zero-width characters. Improve 42 rows: don't treat them as having zero-width characters. Improve
29 comments. 43 comments.
diff --git a/src/term.c b/src/term.c
index 31e0ad223db..eda19d21374 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1589,7 +1589,6 @@ append_glyph (it)
1589 } 1589 }
1590} 1590}
1591 1591
1592
1593/* Produce glyphs for the display element described by IT. *IT 1592/* Produce glyphs for the display element described by IT. *IT
1594 specifies what we want to produce a glyph for (character, image, ...), 1593 specifies what we want to produce a glyph for (character, image, ...),
1595 and where in the glyph matrix we currently are (glyph row and hpos). 1594 and where in the glyph matrix we currently are (glyph row and hpos).
@@ -1808,6 +1807,17 @@ append_composite_glyph (it)
1808 glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area]; 1807 glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
1809 if (glyph < it->glyph_row->glyphs[1 + it->area]) 1808 if (glyph < it->glyph_row->glyphs[1 + it->area])
1810 { 1809 {
1810 /* If the glyph row is reversed, we need to prepend the glyph
1811 rather than append it. */
1812 if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
1813 {
1814 struct glyph *g;
1815
1816 /* Make room for the new glyph. */
1817 for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
1818 g[1] = *g;
1819 glyph = it->glyph_row->glyphs[it->area];
1820 }
1811 glyph->type = COMPOSITE_GLYPH; 1821 glyph->type = COMPOSITE_GLYPH;
1812 glyph->pixel_width = it->pixel_width; 1822 glyph->pixel_width = it->pixel_width;
1813 glyph->u.cmp.id = it->cmp_it.id; 1823 glyph->u.cmp.id = it->cmp_it.id;
@@ -1828,6 +1838,18 @@ append_composite_glyph (it)
1828 glyph->padding_p = 0; 1838 glyph->padding_p = 0;
1829 glyph->charpos = CHARPOS (it->position); 1839 glyph->charpos = CHARPOS (it->position);
1830 glyph->object = it->object; 1840 glyph->object = it->object;
1841 if (it->bidi_p)
1842 {
1843 glyph->resolved_level = it->bidi_it.resolved_level;
1844 if ((it->bidi_it.type & 7) != it->bidi_it.type)
1845 abort ();
1846 glyph->bidi_type = it->bidi_it.type;
1847 }
1848 else
1849 {
1850 glyph->resolved_level = 0;
1851 glyph->bidi_type = UNKNOWN_BT;
1852 }
1831 1853
1832 ++it->glyph_row->used[it->area]; 1854 ++it->glyph_row->used[it->area];
1833 ++glyph; 1855 ++glyph;
diff --git a/src/xdisp.c b/src/xdisp.c
index d11812ceb65..721af7b0251 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -17203,6 +17203,31 @@ handle_line_prefix (struct it *it)
17203 17203
17204 17204
17205 17205
17206/* Remove N glyphs at the start of a reversed IT->glyph_row. Called
17207 only for R2L lines from display_line, when it decides that too many
17208 glyphs were produced by PRODUCE_GLYPHS, and the line needs to be
17209 continued. */
17210static void
17211unproduce_glyphs (it, n)
17212 struct it *it;
17213 int n;
17214{
17215 struct glyph *glyph, *end;
17216
17217 xassert (it->glyph_row);
17218 xassert (it->glyph_row->reversed_p);
17219 xassert (it->area == TEXT_AREA);
17220 xassert (n <= it->glyph_row->used[TEXT_AREA]);
17221
17222 if (n > it->glyph_row->used[TEXT_AREA])
17223 n = it->glyph_row->used[TEXT_AREA];
17224 glyph = it->glyph_row->glyphs[TEXT_AREA] + n;
17225 end = it->glyph_row->glyphs[TEXT_AREA] + it->glyph_row->used[TEXT_AREA];
17226 for ( ; glyph < end; glyph++)
17227 glyph[-n] = *glyph;
17228}
17229
17230
17206/* Construct the glyph row IT->glyph_row in the desired matrix of 17231/* Construct the glyph row IT->glyph_row in the desired matrix of
17207 IT->w from text at the current position of IT. See dispextern.h 17232 IT->w from text at the current position of IT. See dispextern.h
17208 for an overview of struct it. Value is non-zero if 17233 for an overview of struct it. Value is non-zero if
@@ -17467,6 +17492,9 @@ display_line (it)
17467 /* A padding glyph that doesn't fit on this line. 17492 /* A padding glyph that doesn't fit on this line.
17468 This means the whole character doesn't fit 17493 This means the whole character doesn't fit
17469 on the line. */ 17494 on the line. */
17495 if (row->reversed_p)
17496 unproduce_glyphs (it, row->used[TEXT_AREA]
17497 - n_glyphs_before);
17470 row->used[TEXT_AREA] = n_glyphs_before; 17498 row->used[TEXT_AREA] = n_glyphs_before;
17471 17499
17472 /* Fill the rest of the row with continuation 17500 /* Fill the rest of the row with continuation
@@ -17489,6 +17517,9 @@ display_line (it)
17489 else if (wrap_row_used > 0) 17517 else if (wrap_row_used > 0)
17490 { 17518 {
17491 back_to_wrap: 17519 back_to_wrap:
17520 if (row->reversed_p)
17521 unproduce_glyphs (it,
17522 row->used[TEXT_AREA] - wrap_row_used);
17492 *it = wrap_it; 17523 *it = wrap_it;
17493 it->continuation_lines_width += wrap_x; 17524 it->continuation_lines_width += wrap_x;
17494 row->used[TEXT_AREA] = wrap_row_used; 17525 row->used[TEXT_AREA] = wrap_row_used;
@@ -17524,6 +17555,9 @@ display_line (it)
17524 /* Something other than a TAB that draws past 17555 /* Something other than a TAB that draws past
17525 the right edge of the window. Restore 17556 the right edge of the window. Restore
17526 positions to values before the element. */ 17557 positions to values before the element. */
17558 if (row->reversed_p)
17559 unproduce_glyphs (it, row->used[TEXT_AREA]
17560 - (n_glyphs_before + i));
17527 row->used[TEXT_AREA] = n_glyphs_before + i; 17561 row->used[TEXT_AREA] = n_glyphs_before + i;
17528 17562
17529 /* Display continuation glyphs. */ 17563 /* Display continuation glyphs. */
@@ -17629,9 +17663,22 @@ display_line (it)
17629 { 17663 {
17630 int i, n; 17664 int i, n;
17631 17665
17632 for (i = row->used[TEXT_AREA] - 1; i > 0; --i) 17666 if (!row->reversed_p)
17633 if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i])) 17667 {
17634 break; 17668 for (i = row->used[TEXT_AREA] - 1; i > 0; --i)
17669 if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i]))
17670 break;
17671 }
17672 else
17673 {
17674 for (i = 0; i < row->used[TEXT_AREA]; i++)
17675 if (!CHAR_GLYPH_PADDING_P (row->glyphs[TEXT_AREA][i]))
17676 break;
17677 /* Remove padding glyphs at the front of ROW, to
17678 make room for the truncation glyphs we will be
17679 adding below. */
17680 unproduce_glyphs (it, i);
17681 }
17635 17682
17636 for (n = row->used[TEXT_AREA]; i < n; ++i) 17683 for (n = row->used[TEXT_AREA]; i < n; ++i)
17637 { 17684 {
@@ -17882,7 +17929,8 @@ display_line (it)
17882 /* The next row should use same value of the reversed_p flag as this 17929 /* The next row should use same value of the reversed_p flag as this
17883 one. set_iterator_to_next decides when it's a new paragraph, and 17930 one. set_iterator_to_next decides when it's a new paragraph, and
17884 PRODUCE_GLYPHS recomputes the value of the flag accordingly. */ 17931 PRODUCE_GLYPHS recomputes the value of the flag accordingly. */
17885 it->glyph_row->reversed_p = row->reversed_p; 17932 if (it->glyph_row < MATRIX_BOTTOM_TEXT_ROW (it->w->desired_matrix, it->w))
17933 it->glyph_row->reversed_p = row->reversed_p;
17886 it->start = row_end; 17934 it->start = row_end;
17887 return row->displays_text_p; 17935 return row->displays_text_p;
17888} 17936}
@@ -21486,6 +21534,17 @@ append_composite_glyph (it)
21486 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area]; 21534 glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
21487 if (glyph < it->glyph_row->glyphs[area + 1]) 21535 if (glyph < it->glyph_row->glyphs[area + 1])
21488 { 21536 {
21537 /* If the glyph row is reversed, we need to prepend the glyph
21538 rather than append it. */
21539 if (it->glyph_row->reversed_p && it->area == TEXT_AREA)
21540 {
21541 struct glyph *g;
21542
21543 /* Make room for the new glyph. */
21544 for (g = glyph - 1; g >= it->glyph_row->glyphs[it->area]; g--)
21545 g[1] = *g;
21546 glyph = it->glyph_row->glyphs[it->area];
21547 }
21489 glyph->charpos = CHARPOS (it->position); 21548 glyph->charpos = CHARPOS (it->position);
21490 glyph->object = it->object; 21549 glyph->object = it->object;
21491 glyph->pixel_width = it->pixel_width; 21550 glyph->pixel_width = it->pixel_width;