Subject: Re: bug#20410: 24.5.50; cursor not updated after yank of non-ASCII string from the clipboard

From: Eli Zaretskii <[email-masked]>
Date: Fri, 24 Apr 2015 09:58:28 +0300

> Date: Fri, 24 Apr 2015 13:09:29 +0900
> From: YAMAMOTO Mitsuharu <[email-masked]>
> Cc: [email-masked]
> 
> >>>>> On Thu, 23 Apr 2015 13:42:40 +0300, Eli Zaretskii <[email-masked]> said:
> 
> >> Date: Thu, 23 Apr 2015 18:59:45 +0900
> >> From: YAMAMOTO Mitsuharu <[email-masked]>
> >> 
> >> 1. Copy some non-ASCII string (say, "あ") to the clipboard.
> >> 2. $ emacs -Q -D &
> >> 3. C-x C-b
> >> 4. C-y
> >> 5. C-p
> >> 
> >> Expected Result:
> >> 
> >> The cursor moves upward by Step 5.
> >> 
> >> Actual Result:
> >> 
> >> The display is not changed between Step 4 and 5.
> 
> > What does "C-x =" report before and after step 5?
> 
> It says
> 
>   Char: C-j (10, #o12, #xa) point=191 of 192 (99%) column=0
> 
> So, the cursor is actually moved internally, but display is not
> updated accordingly.

You show only one result of "C-x =", so it's hard to interpret it,
especially since you didn't show what was displayed after the paste.

Does the cursor move to the correct place if you type C-l or invoke
redraw-display, after performing the recipe?

In any case, cursor motion and display are unrelated to pasting from
the clipboard, so I wonder whether you could reproduce this without
the paste, just by typing that character.  I also wonder what does all
this have to do with expose events, as mentioned in your original
report.  Anything that I could reproduce here and debug it would be
helpful.

Failing that, cursor positioning is done in set_cursor_from_row, so
perhaps you could step through that function and see what's going
wrong there, and why.  That function is called once for every window,
so to be sure you look at the correct invocation, make sure the value
of w->contents at function entry is the *scratch* buffer.

The output of the GDB command "pgrow", defined on src/.gdbinit, when
inside set_cursor_from_row, is also important.

> I also tried git bisect, and it shows:
> 
> bd0443bb8799b908cefd0b11c86db6115180850d is the first bad commit
> commit bd0443bb8799b908cefd0b11c86db6115180850d
> Author: Dmitry Antipov <[email-masked]>
> Date:   Fri Sep 6 11:00:29 2013 +0400
> 
>     Attempt to make redisplay more selective when changing fonts.

Thanks, but such jumbo changes rarely help in debugging problems,
especially since they don't seem to touch the cursor setting function,
at least not directly.  So I think we need to debug this problem.