Subject: Re: bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin

From: Eli Zaretskii <[email-masked]>
Date: Mon, 04 Sep 2017 18:32:19 +0300

> From: yorwba <[email-masked]>
> Date: Mon, 4 Sep 2017 17:49:25 +0800
> 
> This bug only appears when Emacs is run in a terminal emulator that
> allows changing the window size.
> 
> Steps to reproduce:
> 
> 1. Run `emacs -nw -Q` in a small terminal window
> 2. Evaluate (setq width (window-width (get-buffer-window (current-buffer))))
>    The value is 74 in my case.
> 3. Enlarge the terminal window (I go fullscreen with 150 columns).
> 4. Evaluate (set-window-margins (get-buffer-window (current-buffer)) 0 width)
> 5. Resize the terminal emulator window back to the original size (or smaller).
> 6. The terminal goes blank and no longer reacts to input.
> 
> Attaching gdb and using finish to end all terminating functions, I found that
> it gets stuck in move_it_vertically_backwards (in xdisp.c). It keeps taking
> the goto move_further_back without actually moving further back.
> 
> I believe that this is caused by incorrectly adjusting the margins when the
> total available width changes.

Thanks, but please also show the C backtrace from the place where
Emacs hangs, it's an important part of the problem.