From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: modem Newsgroups: gmane.emacs.bugs Subject: bug#24124: emacs terminal escape command error Date: Mon, 1 Aug 2016 16:34:43 +0200 Message-ID: <579F5E03.70201@member.fsf.org> 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 1470063816 5506 80.91.229.8 (1 Aug 2016 15:03:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 1 Aug 2016 15:03:36 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 Lightning/4.7.1.1 To: 24124@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 01 17:03:21 2016 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 1bUEkS-00014s-An for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Aug 2016 17:03:20 +0200 Original-Received: from localhost ([::1]:50843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUEkO-0006mm-In for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Aug 2016 11:03:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUEkI-0006lp-DP for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2016 11:03:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUEkA-0002Lp-Rr for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2016 11:03:09 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55773) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUEkA-0002LZ-OE for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2016 11:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bUEkA-0007Gd-E0 for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2016 11:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: modem Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Aug 2016 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24124 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.147006373627882 (code B ref -1); Mon, 01 Aug 2016 15:03:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Aug 2016 15:02:16 +0000 Original-Received: from localhost ([127.0.0.1]:53070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUEjL-0007FZ-1v for submit@debbugs.gnu.org; Mon, 01 Aug 2016 11:02:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:41108) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUEKG-0006fv-BL for submit@debbugs.gnu.org; Mon, 01 Aug 2016 10:36:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUEKA-0006PH-2v for submit@debbugs.gnu.org; Mon, 01 Aug 2016 10:36:11 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:49265) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUEKA-0006PC-0Q for submit@debbugs.gnu.org; Mon, 01 Aug 2016 10:36:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60282) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUEK5-0003DM-Ki for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2016 10:36:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUEK0-0006Mo-Hc for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2016 10:36:05 -0400 Original-Received: from relay3-d.mail.gandi.net ([217.70.183.195]:35534) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUEK0-0006Mf-AS for bug-gnu-emacs@gnu.org; Mon, 01 Aug 2016 10:36:00 -0400 Original-Received: from mfilter46-d.gandi.net (mfilter46-d.gandi.net [217.70.178.177]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 1B13DA80CE for ; Mon, 1 Aug 2016 16:35:59 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter46-d.gandi.net Original-Received: from relay3-d.mail.gandi.net ([IPv6:::ffff:217.70.183.195]) by mfilter46-d.gandi.net (mfilter46-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id hYePeBOYUp-1 for ; Mon, 1 Aug 2016 16:35:56 +0200 (CEST) X-Originating-IP: 217.128.14.246 Original-Received: from [10.0.0.225] (LAubervilliers-656-1-215-246.w217-128.abo.wanadoo.fr [217.128.14.246]) (Authenticated sender: n.brito@lexfo.fr) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 9F4AFA80ED for ; Mon, 1 Aug 2016 16:35:55 +0200 (CEST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Mon, 01 Aug 2016 11:02:09 -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:121757 Archived-At: Hi, I am facing a problem with emacs inside tmux. The problem can be reproduced easily. Emacs seems to have an terminal issue when being back from background mode on shell. Let me explain: When I put emacs in background (^z) and then in foreground again ("fg", bash) sometime emacs will not reset properly the terminal and I won't be able to scroll up (using PageUp/PageDown). After debugging the issue with a tmux developer, we tracked it down to emacs and believe this is an emacs issue with terminal handling when going back from background mode. I am attaching a snippet of the technical detail about this issue : > When you ^Z, tmux gets 112 bytes in all cases: > > input_parse: %0 ground, 40 bytes: \n\n\033[K\033[?1l\033>\033[34h\033[?25h\033[?1049l\033[39;49m\r > input_parse: %0 ground, 72 bytes: \r\n[1]+ Stopped emacs large_text_file.txt\r\nroot@milu:~# > > \033[?1049l is rmcup which exits cursor positioning (alternate screen) mode. > > Then when you type fg, it gets: > > input_parse: %0 ground, 694 bytes: \033[?1049h\033[34l\033[?1h\033=\033[24;1H\033[K\033[H\033[?25l\033[3mFile Edit Options Buffers ... > > \033[?1049h is smcup which turns it on again. > > But sometimes, it gets: > > input_parse: %0 ground, 674 bytes: \033[24;1H\033[K\033[H\033[?25l\033[3mFile Edit Options Buffers ... > > Where emacs is not sending \033[1049h, or in fact any of the smcup, > cvvis, smkx sequence it normally sends. This can be reproduced by hitting ^z and then "fg" in a loop for a couples of minutes. If you run tmux with "tmux -vvvv" you will be able to obtain the logs mentionned above. To observe the problem you can just press PageUp each time you are back in emacs, when the bug will reproduce you won't pageUp inside emacs but enter the tmux's copy-mode. My ~/.tmux.conf only has 1 line: bind-key -T root PPage if-shell -F "#{alternate_on}" "send-keys PPage" "copy-mode -e -u" If you need me to apply some patch and/or reproduce just let me know I will happily helps. Thanks a lot, -- modem