diff src/bidi.c @ 108657:7e4a23f2f3ea

Completed initial debugging and testing of reimplemented cursor motion. .gdbinit (prowlims): Display row->minpos and row->maxpos. Display truncated_on_left_p and truncated_on_right_p flags. Formatting fixes. (pmtxrows): Display the ordinal number of each row. Don't display rows beyond the last one. xdisp.c (RECORD_MAX_MIN_POS): New macro. (display_line): Use it to record the minimum and maximum buffer positions for glyphs in the row being assembled. If word wrap is in effect, restore minimum and maximum positions seen up to the wrap point, when iterator returns to it. (find_row_edges): Fix logic; eol_pos should be tested before the rest. (try_window_reusing_current_matrix): Give up if in bidi-reordered row and cursor not already at point. Restore original pre-bidi code for unidirectional buffers. bidi.c (bidi_cache_shrink, bidi_cache_iterator_state): Fix reallocation of the cache. (Bug#6210) (bidi_cache_iterator_state): Don't zero out new_paragraph (it is not copied by bidi_copy_it).
author Eli Zaretskii <eliz@gnu.org>
date Wed, 19 May 2010 23:24:21 +0300
parents 178b4c78d882
children 3339da3cfeb3
line wrap: on
line diff
--- a/src/bidi.c	Tue May 18 18:22:15 2010 +0300
+++ b/src/bidi.c	Wed May 19 23:24:21 2010 +0300
@@ -543,6 +543,7 @@
 #define BIDI_CACHE_CHUNK 200
 static struct bidi_it *bidi_cache;
 static size_t bidi_cache_size = 0;
+static size_t elsz = sizeof (struct bidi_it);
 static int bidi_cache_idx;	/* next unused cache slot */
 static int bidi_cache_last_idx;	/* slot of last cache hit */
 
@@ -558,8 +559,9 @@
 {
   if (bidi_cache_size > BIDI_CACHE_CHUNK)
     {
-      bidi_cache_size = BIDI_CACHE_CHUNK * sizeof (struct bidi_it);
-      bidi_cache = (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size);
+      bidi_cache_size = BIDI_CACHE_CHUNK;
+      bidi_cache =
+	(struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size * elsz);
     }
   bidi_cache_reset ();
 }
@@ -688,9 +690,9 @@
       /* Enlarge the cache as needed.  */
       if (idx >= bidi_cache_size)
 	{
-	  bidi_cache_size += BIDI_CACHE_CHUNK * sizeof (struct bidi_it);
+	  bidi_cache_size += BIDI_CACHE_CHUNK;
 	  bidi_cache =
-	    (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size);
+	    (struct bidi_it *) xrealloc (bidi_cache, bidi_cache_size * elsz);
 	}
       /* Character positions should correspond to cache positions 1:1.
 	 If we are outside the range of cached positions, the cache is
@@ -705,7 +707,6 @@
       bidi_copy_it (&bidi_cache[idx], bidi_it);
       if (!resolved)
 	bidi_cache[idx].resolved_level = -1;
-      bidi_cache[idx].new_paragraph = 0;
     }
   else
     {