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: Wed, 3 Aug 2016 15:21:24 +0200 Message-ID: <57A1EFD4.2060100@member.fsf.org> References: <579F5E03.70201@member.fsf.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090709070509030101060602" X-Trace: blaine.gmane.org 1470231219 21394 195.159.176.226 (3 Aug 2016 13:33:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 3 Aug 2016 13:33:39 +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 Wed Aug 03 15:33:29 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 1bUwH3-0002iL-4x for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Aug 2016 15:31:53 +0200 Original-Received: from localhost ([::1]:34606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUwGz-0006PY-PF for geb-bug-gnu-emacs@m.gmane.org; Wed, 03 Aug 2016 09:31:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUw8Y-0007Y4-AJ for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2016 09:23:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bUw8U-0003v8-8l for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2016 09:23:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56926) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bUw8U-0003v2-4d for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2016 09:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bUw8U-0001T6-0p for bug-gnu-emacs@gnu.org; Wed, 03 Aug 2016 09:23:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <579F5E03.70201@member.fsf.org> Resent-From: modem Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Aug 2016 13:23:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24124 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24124-submit@debbugs.gnu.org id=B24124.14702305645604 (code B ref 24124); Wed, 03 Aug 2016 13:23:01 +0000 Original-Received: (at 24124) by debbugs.gnu.org; 3 Aug 2016 13:22:44 +0000 Original-Received: from localhost ([127.0.0.1]:54223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUw8B-0001SJ-Ur for submit@debbugs.gnu.org; Wed, 03 Aug 2016 09:22:44 -0400 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:42164) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUw8A-0001SC-Ub for 24124@debbugs.gnu.org; Wed, 03 Aug 2016 09:22:43 -0400 Original-Received: from mfilter17-d.gandi.net (mfilter17-d.gandi.net [217.70.178.145]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id C46F917209A for <24124@debbugs.gnu.org>; Wed, 3 Aug 2016 15:22:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter17-d.gandi.net Original-Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter17-d.gandi.net (mfilter17-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id f-xPeUQDe6XA for <24124@debbugs.gnu.org>; Wed, 3 Aug 2016 15:22:40 +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 relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 2589F172095 for <24124@debbugs.gnu.org>; Wed, 3 Aug 2016 15:22:39 +0200 (CEST) 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:121799 Archived-At: This is a multi-part message in MIME format. --------------090709070509030101060602 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit > [Please keep the bug address on the CC list.] > >> Thanks you for your advises. >> >> My terminfo: "echo $TERM" return "screen". Is that it ? > > Probably. > >> I recompiled emacs after commenting a few optimization in src/cm.c (cmgoto). >> Unfortunately I can still reproduce the bug with this binary. >> >> I am attaching you the patch I did. > > I think you disabled the wrong code. What you need is force Emacs to > always do this: > > if (cost <= relcost)œ > { /* really is cheaper */ > emacs_tputs (tty, p, 1, cmputc); > curY (tty) = row, curX (tty) = col; > return; > } Hi Eli, Thanks a lot. So I did another patch and another try. I can still reproduce the bug. Any more advices on stuff I should try are welcomed ;-) Here is the patch: --- emacs24-24.4+1.orig/src/cm.c 2014-10-21 23:45:42.000000000 +0200 +++ /dev/shm/cm.c 2016-08-03 15:10:55.803193217 +0200 @@ -327,10 +327,12 @@ char *p; const char *dcm; +#if 0 /* First the degenerate case */ if (row == curY (tty) && col == curX (tty)) /* already there */ return; - +#endif // XXX MODEM + if (curY (tty) >= 0 && curX (tty) >= 0) { /* We may have quick ways to go to the upper-left, bottom-left, @@ -375,7 +377,7 @@ * In the following comparison, the = in <= is because when the costs * are the same, it looks nicer (I think) to move directly there. */ - if (directcost <= relcost) + if (directcost <= relcost || 1) // XXX MODEM { /* compute REAL direct cost */ cost = 0; @@ -383,14 +385,14 @@ ? tgoto (dcm, row, col) : tgoto (dcm, col, row)); emacs_tputs (tty, p, 1, evalcost); - if (cost <= relcost) + if (cost <= relcost || 1) // XXX MODEM { /* really is cheaper */ emacs_tputs (tty, p, 1, cmputc); curY (tty) = row, curX (tty) = col; return; } } - + switch (use) { case USEHOME: --------------090709070509030101060602 Content-Type: text/x-patch; name="second_try.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="second_try.patch" --- emacs24-24.4+1.orig/src/cm.c 2014-10-21 23:45:42.000000000 +0200 +++ /dev/shm/cm.c 2016-08-03 15:10:55.803193217 +0200 @@ -327,10 +327,12 @@ char *p; const char *dcm; +#if 0 /* First the degenerate case */ if (row == curY (tty) && col == curX (tty)) /* already there */ return; - +#endif // XXX MODEM + if (curY (tty) >= 0 && curX (tty) >= 0) { /* We may have quick ways to go to the upper-left, bottom-left, @@ -375,7 +377,7 @@ * In the following comparison, the = in <= is because when the costs * are the same, it looks nicer (I think) to move directly there. */ - if (directcost <= relcost) + if (directcost <= relcost || 1) // XXX MODEM { /* compute REAL direct cost */ cost = 0; @@ -383,14 +385,14 @@ ? tgoto (dcm, row, col) : tgoto (dcm, col, row)); emacs_tputs (tty, p, 1, evalcost); - if (cost <= relcost) + if (cost <= relcost || 1) // XXX MODEM { /* really is cheaper */ emacs_tputs (tty, p, 1, cmputc); curY (tty) = row, curX (tty) = col; return; } } - + switch (use) { case USEHOME: --------------090709070509030101060602--