Eli Zaretskii writes: > can you put a printf after this line from xdisp.c: > > else if (it->bidi_it.charpos == bob > || (!string_p > && (FETCH_CHAR (it->bidi_it.bytepos - 1) == '\n' > || FETCH_CHAR (it->bidi_it.bytepos) == '\n'))) > { > /* If we are at the beginning of a line/string, we can produce > the next element right away. */ > bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1); <<<<<< > > and tell me once in how many characters or lines of input from `ls' is > bidi_paragraph_init called here? E.g., to see the character count, > print it->bidi_it.charpos just before that line. Here are the line numbers at which the printf is triggered (and how many times consecutively they get triggered, in parentheses): 1 (x 5) 0 (x 16) 10 (x 2) 1 (x 3) 0 (x 16) 68 (x 4) 37 1606 (x 3) 0 (x 16) 125 (x 4) 94 93 (x 3) 0 (x 16) 183 (x 4) 152 151 (x 3) 0 (x 16) 241 (x 4) 210 (x 4) 0 (x 16) 299 (x 4) 268 267 (x 3) 0 (x 16) 358 (x 4) 327 326 (x 3) 0 (x 16) 417 (x 4) 386 385 (x 3) 0 (x 16) 476 (x 4) 445 444 (x 3) 0 (x 16) 533 (x 4) 502 501 (x 3) 0 (x 16) 590 (x 4) 559 558 (x 3) 0 (x 16) ... and so on. This is over one single ls call. The 0's are when it->bidi_it.charpos == 0, the rest are charpos's converted into buffer line numbers. The pattern seems to be 3 calls at each window end, then 1 on the second line of the window, then 4 on the first window line. After many `ls' calls, when redisplay has become sluggish, the pattern is the same. ... 6788 (x 4) 6757 6756 (x 3) 0 (x 16) 6846 (x 4) 6815 6814 (x 3) 0 (x 16) 6897 (x 4) 6866 6865 (x 3) 0 (x 16) The shell output for one ls call is attached, in case it is useful.