From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: yorwba Newsgroups: gmane.emacs.bugs Subject: bug#28346: 24.5; Emacs hangs when terminal becomes smaller than set margin Date: Mon, 4 Sep 2017 17:49:25 +0800 Message-ID: <0cffd11a-a66d-c872-76e8-af4aaf21c9ca@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1504538160 15310 195.159.176.226 (4 Sep 2017 15:16:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 4 Sep 2017 15:16:00 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 To: 28346@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Sep 04 17:15:45 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dot68-0002tw-Ps for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Sep 2017 17:15:37 +0200 Original-Received: from localhost ([::1]:54394 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dot6F-0004Dp-Ov for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Sep 2017 11:15:43 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47496) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dot5P-0003xD-Td for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 11:15:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dot4d-0005cm-4f for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 11:14:51 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40358) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dot4c-0005cf-W6 for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 11:14:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dot4c-0005LK-Qi for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 11:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: yorwba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Sep 2017 15:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28346 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.150453802520484 (code B ref -1); Mon, 04 Sep 2017 15:14:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Sep 2017 15:13:45 +0000 Original-Received: from localhost ([127.0.0.1]:49037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dot4K-0005KK-SU for submit@debbugs.gnu.org; Mon, 04 Sep 2017 11:13:45 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36747) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1doo0z-00023H-4M for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doo0n-0002CE-V5 for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:51 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51730) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1doo0n-0002Bu-Rr for submit@debbugs.gnu.org; Mon, 04 Sep 2017 05:49:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1doo0i-0004jW-58 for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1doo0c-00023I-M7 for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:40 -0400 Original-Received: from mail-it0-x22c.google.com ([2607:f8b0:4001:c0b::22c]:36335) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1doo0c-00020z-GB for bug-gnu-emacs@gnu.org; Mon, 04 Sep 2017 05:49:34 -0400 Original-Received: by mail-it0-x22c.google.com with SMTP id j17so912955iti.1 for ; Mon, 04 Sep 2017 02:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=n/ltVP5N0lOetD3r8k1lKRo7wMSNBHQ+h1hj0wiCrQc=; b=pllL7LIXoSY+0ascVvvumVK7ciwwdcm4ugU35k5IuHFNTnDfMY2Woo8sNJIDDf/uGc ZFoR/TS1WkdgN4+KH6Svn3Fm6n0AywS74mrZ66V3MA3ydfOHxfXY7RfM1MzlwKUK5dXG N5SX2w2p2pQRKVjE9f71hGRjzaOXEjiuFYY1a+A+LzcZczIsPsUD4w0EU2bvq+s+q+R8 u0JVXr8Ha4vVsd5Y7GkpqyLAKuPXoWR4WIO3PpmiPymlrOUK3uE8YgFSVgkfxYFQa0td jQBD/sLPuJp6MGkYIbwIsh3+q2N/KzOrcC6q2bs6oS9Untv6Y/z4eaToEmwR0DG7TE2y OSeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=n/ltVP5N0lOetD3r8k1lKRo7wMSNBHQ+h1hj0wiCrQc=; b=iOaEHcagAQ4zsMHOTx/tzrnqBBdTyY0i+SY+g1we39e+k7pw2ItgSoPqniXsuCK4ox RNRndtsCj40lECaVaJecBPrQ2s6+LiOF2jj+wyh5XldjiHmLc6Me5HL+/xKOJuu6pMsv Xj9Pds4JplGgDqC9Sug40PGEUdTWq5R530e4A3jNJSuwWHYwXH/HzY2075vjOKr0Z/Hd adbV3R5cTNayh2GgtNlkmYQeujvEuVgk+mYv0qD7AlwLXw3qvWuPDtkJCAnHcXPtlVLW zX8YRFbs9i1YORppcC4mTdnrItUbAiVrfIbBvMxKo093td+EwJ5MsWIWk81FkYK5K9ZY W4lQ== X-Gm-Message-State: AHPjjUjN2Euwoxk177K7OaoN6+cuDvfTXA3vxid1VaYKM1MBa4QvGsXi mcovJZbMvfA4jHYh X-Google-Smtp-Source: ADKCNb6dNaahzCzRB5VMfu3su3zTcDvIyRdG2i/Wpo3rM+SsNSUuB93zYLzPx3REr/CyE3wN2+Oabg== X-Received: by 10.36.138.69 with SMTP id v66mr7124700itd.106.1504518570979; Mon, 04 Sep 2017 02:49:30 -0700 (PDT) Original-Received: from [192.168.1.12] ([180.158.103.16]) by smtp.googlemail.com with ESMTPSA id d69sm104425itc.18.2017.09.04.02.49.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Sep 2017 02:49:30 -0700 (PDT) Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Mon, 04 Sep 2017 11:13:43 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:136579 Archived-At: 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. What I see in GDB: (gdb) p *it->w $2 = {header = {size = 4611686018494636052}, frame = 12472813, next = 12473765, prev = 12392562, parent = 12392562, normal_lines = 12367919, normal_cols = 12367927, new_total = 0, new_normal = 0, new_pixel = 0, contents = 12419381, start = 12418371, pointm = 12418411, temslot = 12392562, vertical_scroll_bar = 12392562, vertical_scroll_bar_type = 12392610, display_table = 12392562, dedicated = 12392562, redisplay_end_trigger = 12392562, combination_limit = 12392562, window_parameters = 12392562, current_matrix = 0xbe8ce0, desired_matrix = 0xbe8c70, prev_buffers = 12392562, next_buffers = 12392562, use_time = 1, sequence_number = 1, pixel_left = 0, pixel_top = 1, left_col = 0, top_line = 1, pixel_width = 74, pixel_height = 40, total_cols = 74, total_lines = 40, hscroll = 0, min_hscroll = 0, last_modified = 0, last_overlay_modified = 0, last_point = 322, base_line_number = 0, base_line_pos = 1, column_number_displayed = -1, nrows_scale_factor = 1, ncols_scale_factor = 1, cursor = {x = 0, y = 6, hpos = 0, vpos = -1}, phys_cursor = {x = 0, y = 0, hpos = 0, vpos = 0}, output_cursor = {x = 0, y = 0, hpos = 0, vpos = 0}, last_cursor_vpos = 6, phys_cursor_type = NO_CURSOR, phys_cursor_width = -1, phys_cursor_ascent = 0, phys_cursor_height = 0, left_fringe_width = -1, right_fringe_width = -1, left_margin_cols = 0, right_margin_cols = 74, scroll_bar_width = -1, mode_line_height = 1, header_line_height = -1, window_end_pos = 282, window_end_vpos = 38, mini = false, horizontal = false, update_mode_line = true, last_had_star = true, start_at_line_beg = true, force_start = false, optional_new_start = false, phys_cursor_on_p = false, cursor_off_p = false, last_cursor_off_p = false, must_be_updated_p = true, pseudo_window_p = false, fringes_outside_margins = false, window_end_valid = false, redisplay = true, vscroll = 0, window_end_bytepos = 282} (gdb) p *it->w->current_matrix $3 = {pool = 0xbaaca0, rows = 0xc757b0, rows_allocated = 60, nrows = 40, matrix_x = 0, matrix_y = 1, matrix_w = 74, matrix_h = 40, window_pixel_left = 0, window_pixel_top = 1, window_height = 39, window_width = 74, window_vscroll = 0, left_margin_glyphs = 0, right_margin_glyphs = 36, no_scrolling_p = false, header_line_p = false, buffer = 0xbd8130, begv = 1, zv = 322} (gdb) p *it->w->desired_matrix $4 = {pool = 0xbaabd0, rows = 0xc64800, rows_allocated = 60, nrows = 40, matrix_x = 0, matrix_y = 1, matrix_w = 74, matrix_h = 40, window_pixel_left = 0, window_pixel_top = 1, window_height = 39, window_width = 74, window_vscroll = 0, left_margin_glyphs = 0, right_margin_glyphs = 36, no_scrolling_p = false, header_line_p = false, buffer = 0x0, begv = 0, zv = 0} Notice that current_matrix and desired_matrix both have window_width = 74 and right_margin_glyphs = 36, but the window itself has total_cols = 74 and right_margin_cols = 74. I hope that's enough info to reproduce and fix this issue. In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-17 on lgw01-04, modified by Debian System Description: Ubuntu 16.04.3 LTS Configured using: `configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'' Important settings: value of $LC_MONETARY: en_US.UTF-8 value of $LC_NUMERIC: en_US.UTF-8 value of $LC_TIME: en_US.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=fcitx locale-coding-system: utf-8-unix Major mode: Fundamental Minor modes in effect: tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t line-number-mode: t transient-mark-mode: t Recent messages: Loading debian-ispell...done Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)... Loading cjk-enc...done Loading /etc/emacs/site-start.d/50latex-cjk-common.el (source)...done Loading /etc/emacs/site-start.d/50latex-cjk-thai.el (source)...done Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... Load-path shadows: /usr/share/emacs/24.5/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs24/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /usr/share/emacs24/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/24.5/lisp/language/thai-word Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils help-mode easymenu xterm time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 79653 6239) (symbols 48 17875 0) (miscs 40 71 113) (strings 32 10754 4684) (string-bytes 1 267933) (vectors 16 7270) (vector-slots 8 343931 30089) (floats 8 66 517) (intervals 56 212 0) (buffers 960 13) (heap 1024 12619 1914))