From unknown Sun Jun 22 22:40:21 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#7485 <7485@debbugs.gnu.org> To: bug#7485 <7485@debbugs.gnu.org> Subject: Status: 23.2; Fix removing unrecognized ANSI sequences in ansi-color-apply Reply-To: bug#7485 <7485@debbugs.gnu.org> Date: Mon, 23 Jun 2025 05:40:21 +0000 retitle 7485 23.2; Fix removing unrecognized ANSI sequences in ansi-color-a= pply reassign 7485 emacs submitter 7485 Leo severity 7485 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 26 09:43:04 2010 Received: (at submit) by debbugs.gnu.org; 26 Nov 2010 14:43:05 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PLzVv-0007c1-Ld for submit@debbugs.gnu.org; Fri, 26 Nov 2010 09:43:03 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PLzVu-0007bY-9w for submit@debbugs.gnu.org; Fri, 26 Nov 2010 09:43:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLzb8-0007Z0-NY for submit@debbugs.gnu.org; Fri, 26 Nov 2010 09:48:28 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL,T_TVD_MIME_NO_HEADERS autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:48504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLzb8-0007Yp-Di for submit@debbugs.gnu.org; Fri, 26 Nov 2010 09:48:26 -0500 Received: from [140.186.70.92] (port=53137 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLzb7-0005DT-By for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 09:48:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLzb4-0007YS-TM for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 09:48:25 -0500 Received: from ppsw-50.csi.cam.ac.uk ([131.111.8.150]:36488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLzb4-0007YE-PE for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 09:48:22 -0500 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com ([86.9.122.85]:59479 helo=Victoria.local) by ppsw-50.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.157]:587) with esmtpsa (PLAIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1PLzb2-0007Ma-sg (Exim 4.72) (return-path ); Fri, 26 Nov 2010 14:48:21 +0000 From: Leo To: bug-gnu-emacs@gnu.org Subject: 23.2; Fix removing unrecognized ANSI sequences in ansi-color-apply Date: Fri, 26 Nov 2010 14:48:20 +0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: submit Cc: Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) --=-=-= In ansi-color-apply, (string-match "\033" string start) finds the wrong portion of context if unrecognized ANSI sequences is not removed before the match. This can cause, for example, eshell's prompt to disappear if ansi-color-apply is used in eshell-preoutput-filter-functions. The attached patch tries to fix this. Leo --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=fix-ansi.diff Content-Description: fix-ansi.diff diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 146c6c9..8d5cbe1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-11-26 Leo + + * ansi-color.el (ansi-color-apply): Also eliminate unrecognized + ANSI sequences for remaining string. + 2010-10-03 Chong Yidong * minibuffer.el (completion--some, completion--do-completion) diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 00162c9..40c0066 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -341,12 +341,15 @@ See `ansi-color-unfontify-region' for a way around this." (put-text-property start (length string) 'ansi-color t string) (put-text-property start (length string) 'face face string)) ;; save context, add the remainder of the string to the result - (let (fragment) - (if (string-match "\033" string start) + (let ((remaining (substring string start)) + fragment) + (while (string-match ansi-color-drop-regexp remaining) + (setq remaining (replace-match "" nil nil remaining))) + (if (string-match "\033" remaining) (let ((pos (match-beginning 0))) - (setq fragment (substring string pos)) - (push (substring string start pos) result)) - (push (substring string start) result)) + (setq fragment (substring remaining pos)) + (push (substring remaining 0 pos) result)) + (push remaining result)) (if (or face fragment) (setq ansi-color-context (list face fragment)) (setq ansi-color-context nil))) --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 26 13:49:58 2010 Received: (at submit) by debbugs.gnu.org; 26 Nov 2010 18:49:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PM3Mr-0004hd-Bx for submit@debbugs.gnu.org; Fri, 26 Nov 2010 13:49:57 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PM3Mo-0004hS-U1 for submit@debbugs.gnu.org; Fri, 26 Nov 2010 13:49:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PM3S4-00048E-H1 for submit@debbugs.gnu.org; Fri, 26 Nov 2010 13:55:21 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:39008) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PM3S4-00048A-Eq for submit@debbugs.gnu.org; Fri, 26 Nov 2010 13:55:20 -0500 Received: from [140.186.70.92] (port=50908 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PM3S3-00061m-Jt for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 13:55:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PM3S2-00047u-At for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 13:55:19 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:50847 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PM3S2-00047o-8L for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 13:55:18 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgwJAI6R70xFxKB0/2dsb2JhbACiEn1ywCGFRwSEXI1t X-IronPort-AV: E=Sophos;i="4.59,262,1288584000"; d="scan'208";a="83792995" Received: from 69-196-160-116.dsl.teksavvy.com (HELO ceviche.home) ([69.196.160.116]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 26 Nov 2010 13:55:16 -0500 Received: by ceviche.home (Postfix, from userid 20848) id 9A6B5660DC; Fri, 26 Nov 2010 13:55:16 -0500 (EST) From: Stefan Monnier To: Leo Subject: Re: 23.2; Fix removing unrecognized ANSI sequences in ansi-color-apply Message-ID: References: Date: Fri, 26 Nov 2010 13:55:16 -0500 In-Reply-To: (Leo's message of "Fri, 26 Nov 2010 14:48:20 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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 (newer, 2) X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.1 (----) > In ansi-color-apply, (string-match "\033" string start) finds the wrong > portion of context if unrecognized ANSI sequences is not removed before > the match. You mean, because \033 can appear in that unrecognized ANSI sequence? > This can cause, for example, eshell's prompt to disappear if > ansi-color-apply is used in eshell-preoutput-filter-functions. > The attached patch tries to fix this. I don't quite understand your patch. And your saying "tries to fix" doesn't make me more confident. > diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el > index 00162c9..40c0066 100644 > *** a/lisp/ansi-color.el > --- b/lisp/ansi-color.el > *************** > *** 341,352 **** > (put-text-property start (length string) 'ansi-color t string) > (put-text-property start (length string) 'face face string)) > ;; save context, add the remainder of the string to the result > ! (let (fragment) > ! (if (string-match "\033" string start) > (let ((pos (match-beginning 0))) > ! (setq fragment (substring string pos)) > ! (push (substring string start pos) result)) > ! (push (substring string start) result)) > (if (or face fragment) > (setq ansi-color-context (list face fragment)) > (setq ansi-color-context nil))) > --- 341,355 ---- > (put-text-property start (length string) 'ansi-color t string) > (put-text-property start (length string) 'face face string)) > ;; save context, add the remainder of the string to the result > ! (let ((remaining (substring string start)) > ! fragment) > ! (while (string-match ansi-color-drop-regexp remaining) > ! (setq remaining (replace-match "" nil nil remaining))) > ! (if (string-match "\033" remaining) > (let ((pos (match-beginning 0))) > ! (setq fragment (substring remaining pos)) > ! (push (substring remaining 0 pos) result)) > ! (push remaining result)) > (if (or face fragment) > (setq ansi-color-context (list face fragment)) > (setq ansi-color-context nil))) This appears to "drop control sequences" even tho they weren't dropped before, so it does more than "ignore false-positive \033 from unrecognized control sequences". IIUC those unrecognized control sequences are dropped elsewhere, right? So are maybe suggesting that they are currently not dropped at the right time (i.e. dropped too late), or that the \033 handling takes place too early, or that we currently forget to drop those control sequences or ... ? Stefan From debbugs-submit-bounces@debbugs.gnu.org Fri Nov 26 17:36:17 2010 Received: (at submit) by debbugs.gnu.org; 26 Nov 2010 22:36:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PM6ts-0001An-Ky for submit@debbugs.gnu.org; Fri, 26 Nov 2010 17:36:17 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PM6tr-0001AX-3O for submit@debbugs.gnu.org; Fri, 26 Nov 2010 17:36:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PM6z7-00084t-6l for submit@debbugs.gnu.org; Fri, 26 Nov 2010 17:41:42 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:58718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PM6z7-00084p-4A for submit@debbugs.gnu.org; Fri, 26 Nov 2010 17:41:41 -0500 Received: from [140.186.70.92] (port=52741 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PM6z6-0007Fx-3f for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 17:41:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PM6z5-00084Z-3q for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 17:41:39 -0500 Received: from ppsw-51.csi.cam.ac.uk ([131.111.8.151]:52891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PM6z4-00084R-KO for bug-gnu-emacs@gnu.org; Fri, 26 Nov 2010 17:41:39 -0500 X-Cam-AntiVirus: no malware found X-Cam-SpamDetails: not scanned X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ Received: from cpc1-cmbg13-0-0-cust596.5-4.cable.virginmedia.com ([86.9.122.85]:60162 helo=Victoria.local) by ppsw-51.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.158]:587) with esmtpsa (PLAIN:sl392) (TLSv1:DHE-RSA-AES128-SHA:128) id 1PM6yz-0000xd-Ws (Exim 4.72) (return-path ); Fri, 26 Nov 2010 22:41:33 +0000 From: Leo To: Stefan Monnier Subject: Re: 23.2; Fix removing unrecognized ANSI sequences in ansi-color-apply References: Date: Fri, 26 Nov 2010 22:41:31 +0000 In-Reply-To: (Stefan Monnier's message of "Fri, 26 Nov 2010 13:55:16 -0500") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (Mac OS X 10.6.5) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: submit Cc: bug-gnu-emacs@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) On 2010-11-26 18:55 +0000, Stefan Monnier wrote: >> In ansi-color-apply, (string-match "\033" string start) finds the wrong >> portion of context if unrecognized ANSI sequences is not removed before >> the match. > > You mean, because \033 can appear in that unrecognized ANSI sequence? Yes. >> This can cause, for example, eshell's prompt to disappear if >> ansi-color-apply is used in eshell-preoutput-filter-functions. >> The attached patch tries to fix this. > > I don't quite understand your patch. And your saying "tries to fix" > doesn't make me more confident. which means I only briefly tested the patch and it seems not to make things worse while fixing a bug that annoys me ;) >> diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el >> index 00162c9..40c0066 100644 >> *** a/lisp/ansi-color.el >> --- b/lisp/ansi-color.el >> *************** >> *** 341,352 **** >> (put-text-property start (length string) 'ansi-color t string) >> (put-text-property start (length string) 'face face string)) >> ;; save context, add the remainder of the string to the result >> ! (let (fragment) >> ! (if (string-match "\033" string start) >> (let ((pos (match-beginning 0))) >> ! (setq fragment (substring string pos)) >> ! (push (substring string start pos) result)) >> ! (push (substring string start) result)) >> (if (or face fragment) >> (setq ansi-color-context (list face fragment)) >> (setq ansi-color-context nil))) >> --- 341,355 ---- >> (put-text-property start (length string) 'ansi-color t string) >> (put-text-property start (length string) 'face face string)) >> ;; save context, add the remainder of the string to the result >> ! (let ((remaining (substring string start)) >> ! fragment) >> ! (while (string-match ansi-color-drop-regexp remaining) >> ! (setq remaining (replace-match "" nil nil remaining))) >> ! (if (string-match "\033" remaining) >> (let ((pos (match-beginning 0))) >> ! (setq fragment (substring remaining pos)) >> ! (push (substring remaining 0 pos) result)) >> ! (push remaining result)) >> (if (or face fragment) >> (setq ansi-color-context (list face fragment)) >> (setq ansi-color-context nil))) > > This appears to "drop control sequences" even tho they weren't dropped > before, so it does more than "ignore false-positive \033 from > unrecognized control sequences". IIUC those unrecognized control > sequences are dropped elsewhere, right? So are maybe suggesting that > they are currently not dropped at the right time (i.e. dropped too > late), or that the \033 handling takes place too early, or that we > currently forget to drop those control sequences or ... ? > > > Stefan Unrecognized control sequences also begin with char \033. The FRAGMENT part of ansi-color-context wasn't supposed to contain actual text, otherwise they might get lost. It should always be a fragment of a whole ansi control sequence if non-nil. Let me show how this stops eshell prompt from showing. Assume ansi-color-apply is in eshell-preoutput-filter-functions. Suppose the output of shell command 'ack linux' ends with an unrecognized control sequence ^[[K. The whole output string that goes through ansi-color-apply is output of 'ack linux' + 'eshell prompt'. After 'ack linux' finishes, the FRAGMENT of ansi-color-context becomes: #("^[[K\n~/.emacs.d $ " 4 17 (read-only t face eshell-prompt rear-nonsticky (face read-only))) The string after being processed by ansi-color-apply is thus without an eshell prompt. Leo From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 03 21:46:49 2017 Received: (at 7485) by debbugs.gnu.org; 4 Jul 2017 01:46:50 +0000 Received: from localhost ([127.0.0.1]:51010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSCvR-0005wg-OE for submit@debbugs.gnu.org; Mon, 03 Jul 2017 21:46:49 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:35785) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSCvO-0005wM-PT; Mon, 03 Jul 2017 21:46:47 -0400 Received: by mail-io0-f194.google.com with SMTP id 84so10172585iop.2; Mon, 03 Jul 2017 18:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=zXoYnH2vhxj0Xuz4PTgNOGN57osG+qAXArtf9gQlj20=; b=VeyvLDvtSGGt8Fu8BBONtJThT+rGBk2PYWhgek3C5jvpoqd3hU1DkbdlQQWFFvMcdy wko6bfIWDzDd4oYHH+rAizGH0oCwHVX4yG39lugEDVD/i3TgG3DfAD9aU/C2oDEdIBgB snw3OwSU+gFkxe3y64eLWPkWmVWzmSefkObKjZVE7Q4mDnlLU40r/mohqiZkdpmXLuP/ 3uYa2qtGLgoohwYbMymRHXF2z2tahMMaX5BpBi53eUXEEkDSnUEQeveJ37DmOYq9Zedu gIwb3KNTHlKn5uGSk2TpBQnpAVMHsxx2tWlZvrFl+VYCxWnTQuzuEsnIa6TGatgwyNBV diUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=zXoYnH2vhxj0Xuz4PTgNOGN57osG+qAXArtf9gQlj20=; b=uElOCZ8FvNYojChbq8ja+MpSA/hQoTILNZgdsc+RTmMMDMdbHPnfnAgBnZEItCb6OW 9rhQA9FgAQnEzPXthNv1yNk3y3z2LjyEIoH6Ji2xmu+zIZuO3/VGV47yUrbgOOXS7OMZ WbnWlF19l45ZbNSuujQyw6WtOKSR60AOrMoBqX2OC+DtNL3LPBBA0U57gagYdv3cpQe+ sfWmaTOoRDDu0muUi5qoy0HFqpMXIWUODK3yvvvI+NHheTai26R8Iq5vECK+tHF9Fkmm YlaCkw8GMjr5JrrSxJff2iDt7AEMlBHm7PUgYtOxjTStjmIjbCajKB2N271hEOfcLYo7 5Eeg== X-Gm-Message-State: AKS2vOycjAV1uVDZS2gF+NyHBxIth5fEXhmcbgM/FuzytPmKmBv2prxO zNDzhrnJMkrt+nDF X-Received: by 10.107.169.29 with SMTP id s29mr40294213ioe.61.1499132800721; Mon, 03 Jul 2017 18:46:40 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id e34sm9418641ioj.62.2017.07.03.18.46.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Jul 2017 18:46:40 -0700 (PDT) From: npostavs@users.sourceforge.net To: Leo Subject: Re: bug#7485: 23.2; Fix removing unrecognized ANSI sequences in ansi-color-apply References: Date: Mon, 03 Jul 2017 21:48:16 -0400 In-Reply-To: (Leo's message of "Fri, 26 Nov 2010 22:41:31 +0000") Message-ID: <87eftxht0f.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 7485 Cc: 7485@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) close 7485 quit Leo writes: > Unrecognized control sequences also begin with char \033. The FRAGMENT > part of ansi-color-context wasn't supposed to contain actual text, > otherwise they might get lost. It should always be a fragment of a whole > ansi control sequence if non-nil. > > Let me show how this stops eshell prompt from showing. > > Assume ansi-color-apply is in eshell-preoutput-filter-functions. Suppose > the output of shell command 'ack linux' ends with an unrecognized > control sequence ^[[K. The whole output string that goes through > ansi-color-apply is > > output of 'ack linux' + 'eshell prompt'. > > After 'ack linux' finishes, the FRAGMENT of ansi-color-context becomes: > > #("^[[K\n~/.emacs.d $ " 4 17 > (read-only t face eshell-prompt rear-nonsticky > (face read-only))) > > The string after being processed by ansi-color-apply is thus without an > eshell prompt. I think this patch is no longer applicable now that I've pushed [1:35ed01dfb3], ansi-color-apply now skips over every escape sequence, not just color escape sequences. Although I'm unable to produce the problem of missing prompts even before my patch (e.g., in 25.2): ~/src $ printf 'ack linux\e[K\n' ack linux ~/src $ [1: 35ed01dfb3]: 2017-07-03 10:09:40 -0400 Fix and simplify ansi escape detection (Bug#21381) http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=35ed01dfb3f811a997e26d843e9971eb6b81b125 From unknown Sun Jun 22 22:40:21 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 01 Aug 2017 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator