bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#27407: 25.2; SGR reset is ignored if it terminates Eshell's output


From: npostavs
Subject: bug#27407: 25.2; SGR reset is ignored if it terminates Eshell's output
Date: Sun, 18 Jun 2017 15:34:11 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)

Pierre Neidhardt <address@hidden> writes:

>> My patch does not solve this scenario, but on the other hand, when I try
>> this experiment in a terminal with bash, not putting a reset does give a
>> coloured prompt, i.e., in the following the 2nd "~/src$" is in yellow:
>>
>>     ~/src$ echo $'\e[33mhello'
>>     hello
>>     ~/src$
>>
>> So should eshell really be any different?
>
> Yes. Definitely. Eshell _already_ is very different and that's why we use
> it. Bash is hardly a role model in the world of shells.
>
> In the case of bash, the issue probably stems back from historical limitations
> of VT* terminals. Something that does not make sense to emulate in modern
> computers.
>
> I don't see any use case for letting the SGR color the shell. If you want to
> change you shell from a command, Elisp is your friend...

Hmm, seems easy enough to fix:

>From 34f41c8573936285076b4e24c2e7ff4d34a48b8d Mon Sep 17 00:00:00 2001
From: Noam Postavsky <address@hidden>
Date: Sun, 18 Jun 2017 15:29:55 -0400
Subject: [PATCH v1] Reset ansi escape context before printing eshell prompt
 (Bug#27407)

* lisp/eshell/em-prompt.el (eshell-emit-prompt): Reset
`ansi-color-context-region'.
---
 lisp/eshell/em-prompt.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index 53a83e6a67..8c81b43b1f 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -117,6 +117,8 @@ (defun eshell-prompt-initialize ()
 
 (defun eshell-emit-prompt ()
   "Emit a prompt if eshell is being used interactively."
+  (when (boundp 'ansi-color-context-region)
+    (setq ansi-color-context-region nil))
   (run-hooks 'eshell-before-prompt-hook)
   (if (not eshell-prompt-function)
       (set-marker eshell-last-output-end (point))
-- 
2.11.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]