aboutsummaryrefslogtreecommitdiffstats
path: root/src/dispextern.h
diff options
context:
space:
mode:
authorEli Zaretskii2010-01-01 09:46:25 -0500
committerEli Zaretskii2010-01-01 09:46:25 -0500
commite69a937075490a19d1b767e166d10f0e838b4173 (patch)
treebfadd69c44dbffc682070d25db53b88abc86cea6 /src/dispextern.h
parent17a024a87de4008cd6cf94dd3b780efc7ace9a01 (diff)
downloademacs-e69a937075490a19d1b767e166d10f0e838b4173.tar.gz
emacs-e69a937075490a19d1b767e166d10f0e838b4173.zip
Retrospective commit from 2009-12-12.
Begin working on faces support. First version of handle_stop_backwards. Rearrange struct bidi_it for more efficient push/pop ops. dispextern.h (struct it): New members prev_stop and base_level_stop. xdisp.c (handle_stop_backwards): New function. (next_element_from_buffer): Handle the situation where we overstepped stop_charpos due to non-linearity of the bidi iteration. Likewise for when we back up beyond the previous stop_charpos. (reseat_1, pop_it, push_it): Set prev_stop and base_level_stop. dispextern.h (BIDI_AT_BASE_LEVEL): New macro. bidi.c (bidi_copy_it): Fix compiler warning due to cast of a pointer to `int'. Don't preserve the first_elt member, as it is no longer copied, because its position in the structure was changed, see below. dispextern.h (struct bidi_it): Move first_elt, new_paragraph, separator_limit, and paragraph_dir to after bidi_stack. Add a note that anything beyond the level stack is not preserved when the bidi iterator state is copied/saved.
Diffstat (limited to 'src/dispextern.h')
-rw-r--r--src/dispextern.h37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 19e3f13fd87..58e6ff91338 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -370,7 +370,7 @@ struct glyph
370 /* Non-zero means don't display cursor here. */ 370 /* Non-zero means don't display cursor here. */
371 unsigned avoid_cursor_p : 1; 371 unsigned avoid_cursor_p : 1;
372 372
373 /* Resolved bidirection level of the characters [0..63]. */ 373 /* Resolved bidirectional level of this character [0..63]. */
374 unsigned resolved_level : 5; 374 unsigned resolved_level : 5;
375 375
376 /* Resolved bidirectional type of this character, see enum 376 /* Resolved bidirectional type of this character, see enum
@@ -750,8 +750,8 @@ struct glyph_row
750 overlay position information etc, where the display of this row 750 overlay position information etc, where the display of this row
751 started, and can thus be less the position of the first glyph 751 started, and can thus be less the position of the first glyph
752 (e.g. due to invisible text or horizontal scrolling). BIDI Note: 752 (e.g. due to invisible text or horizontal scrolling). BIDI Note:
753 This is the smallest character position in the row, i.e. not 753 This is the smallest character position in the row, but not
754 necessarily the character that is displayed the leftmost. */ 754 necessarily the character that is the leftmost on the display. */
755 struct display_pos start; 755 struct display_pos start;
756 756
757 /* Text position at the end of this row. This is the position after 757 /* Text position at the end of this row. This is the position after
@@ -759,8 +759,8 @@ struct glyph_row
759 glyph position + 1, due to truncation, invisible text etc. In an 759 glyph position + 1, due to truncation, invisible text etc. In an
760 up-to-date display, this should always be equal to the start 760 up-to-date display, this should always be equal to the start
761 position of the next row. BIDI Note: this is the character whose 761 position of the next row. BIDI Note: this is the character whose
762 buffer position is the largest, not necessarily the one displayed 762 buffer position is the largest, but not necessarily the rightmost
763 the rightmost. */ 763 one on the display. */
764 struct display_pos end; 764 struct display_pos end;
765 765
766 /* Non-zero means the overlay arrow bitmap is on this line. 766 /* Non-zero means the overlay arrow bitmap is on this line.
@@ -1726,7 +1726,7 @@ struct face_cache
1726 1726
1727extern int face_change_count; 1727extern int face_change_count;
1728 1728
1729/* For BIDI */ 1729/* For reordering of bidirectional text. */
1730#define BIDI_MAXLEVEL 64 1730#define BIDI_MAXLEVEL 64
1731 1731
1732/* Data type for describing the bidirectional character types. The 1732/* Data type for describing the bidirectional character types. The
@@ -1777,7 +1777,6 @@ struct bidi_stack {
1777 1777
1778/* Data type for iterating over bidi text. */ 1778/* Data type for iterating over bidi text. */
1779struct bidi_it { 1779struct bidi_it {
1780 int first_elt; /* if non-zero, examine current char first */
1781 EMACS_INT bytepos; /* iterator's position in buffer */ 1780 EMACS_INT bytepos; /* iterator's position in buffer */
1782 EMACS_INT charpos; 1781 EMACS_INT charpos;
1783 int ch; /* character itself */ 1782 int ch; /* character itself */
@@ -1789,9 +1788,6 @@ struct bidi_it {
1789 int resolved_level; /* final resolved level of this character */ 1788 int resolved_level; /* final resolved level of this character */
1790 int invalid_levels; /* how many PDFs to ignore */ 1789 int invalid_levels; /* how many PDFs to ignore */
1791 int invalid_rl_levels; /* how many PDFs from RLE/RLO to ignore */ 1790 int invalid_rl_levels; /* how many PDFs from RLE/RLO to ignore */
1792 int new_paragraph; /* if non-zero, we expect a new paragraph */
1793 EMACS_INT separator_limit; /* where paragraph separator should end */
1794 bidi_dir_t paragraph_dir; /* current paragraph direction */
1795 int prev_was_pdf; /* if non-zero, previous char was PDF */ 1791 int prev_was_pdf; /* if non-zero, previous char was PDF */
1796 struct bidi_saved_info prev; /* info about previous character */ 1792 struct bidi_saved_info prev; /* info about previous character */
1797 struct bidi_saved_info last_strong; /* last-seen strong directional char */ 1793 struct bidi_saved_info last_strong; /* last-seen strong directional char */
@@ -1803,10 +1799,20 @@ struct bidi_it {
1803 bidi_dir_t sor; /* direction of start-of-run in effect */ 1799 bidi_dir_t sor; /* direction of start-of-run in effect */
1804 int scan_dir; /* direction of text scan */ 1800 int scan_dir; /* direction of text scan */
1805 int stack_idx; /* index of current data on the stack */ 1801 int stack_idx; /* index of current data on the stack */
1802 /* Note: Everything from here is not copied/saved when the bidi
1803 iterator state is saved, pushed, or popped. So only put here
1804 stuff that is not part of the bidi iterator's state! */
1806 struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ 1805 struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */
1806 int first_elt; /* if non-zero, examine current char first */
1807 bidi_dir_t paragraph_dir; /* current paragraph direction */
1808 int new_paragraph; /* if non-zero, we expect a new paragraph */
1809 EMACS_INT separator_limit; /* where paragraph separator should end */
1807}; 1810};
1808 1811
1809 1812/* Value is non-zero when the bidi iterator is at base paragraph
1813 embedding level. */
1814#define BIDI_AT_BASE_LEVEL(BIDI_IT) \
1815 (BIDI_IT).resolved_level == (BIDI_IT).level_stack[0].level
1810 1816
1811 1817
1812/*********************************************************************** 1818/***********************************************************************
@@ -2006,6 +2012,13 @@ struct it
2006 text, overlay strings, end of text etc., which see. */ 2012 text, overlay strings, end of text etc., which see. */
2007 EMACS_INT stop_charpos; 2013 EMACS_INT stop_charpos;
2008 2014
2015 /* Previous stop position, i.e. the last one before the current
2016 buffer position. */
2017 EMACS_INT prev_stop;
2018
2019 /* Last stop_pos at the current paragraph's embedding level. */
2020 EMACS_INT base_level_stop;
2021
2009 /* Maximum string or buffer position + 1. ZV when iterating over 2022 /* Maximum string or buffer position + 1. ZV when iterating over
2010 current_buffer. */ 2023 current_buffer. */
2011 EMACS_INT end_charpos; 2024 EMACS_INT end_charpos;
@@ -2112,6 +2125,8 @@ struct it
2112 int string_nchars; 2125 int string_nchars;
2113 EMACS_INT end_charpos; 2126 EMACS_INT end_charpos;
2114 EMACS_INT stop_charpos; 2127 EMACS_INT stop_charpos;
2128 EMACS_INT prev_stop;
2129 EMACS_INT base_level_stop;
2115 struct composition_it cmp_it; 2130 struct composition_it cmp_it;
2116 int face_id; 2131 int face_id;
2117 2132