Subject: bug#4635: 23.1.50; term-previous-input and split windows

From: Stephen Berman <[email-masked]>
Date: Sun, 26 Sep 2010 15:03:49 +0200

On Sat, 25 Sep 2010 18:07:02 +0200 Johan Bockgård <[email-masked]> wrote:

> Stephen Berman <[email-masked]> writes:
>
>> On Thu, 19 Nov 2009 22:55:57 +0100 Stephen Berman <[email-masked]> wrote:
>>
>>> 1. emacs -Q
>>> 2. M-x term RET
>>> 3. C-c 2
>>> 4. RET
>>> => Cursor jumps from the term prompt to the beginning of the buffer
>>>
>>> I instrumented term.el but could not induce the jump when stepping
>>> through with edebug.  I don't know how else to try debugging this.
>>
>> Manifestations of this bug continue to annoy me (currently using GNU
>> Emacs 23.1.92.1 (i686-pc-linux-gnu, GTK+ Version 2.18.6) of 2010-02-13
>> on escher).  Does anyone have any idea how to fix (or at least debug)
>> it?  Can anyone else reproduce it?
>
> Point is being moved by
>
>   <process filter> -> term-emulate-terminal -> term-check-size ->
>   term-reset-size -> term-set-scroll-region
>
> The same thing will also happen if you resize the window without
> splitting it.

Thanks for tracking that down.  So, if I comment out the sexp (term-goto
0 0) in the last line term-set-scroll-region, the jump still happens,
but only to (line-beginning-position) and then the cursor immediately
returns to the first character after the prompt.  This looks strange but
is at any rate much less disconcerting than jumping to the beginning of
the buffer.  The only other place term-set-scroll-region is called is at
the end of term-handle-ansi-escape; I don't know how to test if this
change causes problems here.  BTW, the jump only happens in character
mode (the default), not in line mode.

Steve Berman