admin管理员组文章数量:1277588
I use bash
under MINGW64 on Windows 10. I had compiled myself a version of wcalc
some years ago, which used to work fine for me - but recently I noticed that it breaks ANSI coloring in the terminal completely:
... that is, instead of getting the following prompt with colors:
user@DESKTOP-PC 2025-02-25|03:41:27 MINGW64 ~
$
... I get this mess of characters, instead of the prompt (after trying to run wcalc 2+2
):
←[?2004h←]0;~
←[32muser@DESKTOP-PC ←[36m2025-02-25|03:41:56←[0m ←[35mMINGW64←[0m ←[33m~←[0m
←[1m$←[0m
You may notice in the screenshot, that running the reset
command (which usually solves all my terminal behavior woes) does not help in restoring the correct behavior.
Would anyone know what command I could use, to restore the correct ANSI color character behavior of the terminal, when I end up in such a state (currently I have no other option but closing and restarting that terminal)
EDIT: I discovered that the problem was that there was an old msys-2.0.dll
and a few others in the same folder as wcalc.exe
; these old DLLs apparently conflicted with the newer DLLs - so the overall solution for me was simply to remove the old dll's from the wcalc
folder, and copy the new DLLs from MSYS2 /bin
there instead.
However it would still be good to know if it is possible to recover from the messy terminal color situation as described above with a command; so I hope someone can answer that.
I use bash
under MINGW64 on Windows 10. I had compiled myself a version of wcalc
some years ago, which used to work fine for me - but recently I noticed that it breaks ANSI coloring in the terminal completely:
... that is, instead of getting the following prompt with colors:
user@DESKTOP-PC 2025-02-25|03:41:27 MINGW64 ~
$
... I get this mess of characters, instead of the prompt (after trying to run wcalc 2+2
):
←[?2004h←]0;~
←[32muser@DESKTOP-PC ←[36m2025-02-25|03:41:56←[0m ←[35mMINGW64←[0m ←[33m~←[0m
←[1m$←[0m
You may notice in the screenshot, that running the reset
command (which usually solves all my terminal behavior woes) does not help in restoring the correct behavior.
Would anyone know what command I could use, to restore the correct ANSI color character behavior of the terminal, when I end up in such a state (currently I have no other option but closing and restarting that terminal)
EDIT: I discovered that the problem was that there was an old msys-2.0.dll
and a few others in the same folder as wcalc.exe
; these old DLLs apparently conflicted with the newer DLLs - so the overall solution for me was simply to remove the old dll's from the wcalc
folder, and copy the new DLLs from MSYS2 /bin
there instead.
However it would still be good to know if it is possible to recover from the messy terminal color situation as described above with a command; so I hope someone can answer that.
Share Improve this question edited Feb 25 at 3:11 sdbbs asked Feb 25 at 2:53 sdbbssdbbs 5,4687 gold badges57 silver badges120 bronze badges 2- 1 For some reason you don't have the termcap database or it cannot be found – Diego Torres Milano Commented Feb 25 at 4:30
- Thanks @DiegoTorresMilano - I fot to mention, wcalc complained of that ever since I first compiled it; but I did not get the above mentioned character problem (until, as mentioned, some days ago) – sdbbs Commented Feb 25 at 11:07
1 Answer
Reset to default 1Short Answer: Not with MINGW64, which uses DLL to process the ANSI escape sequences for colors. Alternative are newer terminal emulator, which have the ASCII escape sequences built into the terminal.
See: Escape sequences unprocessed under the "cygwin" terminal
本文标签: Restore terminal ANSI color behaviour in bash after failure caused by user programStack Overflow
版权声明:本文标题:Restore terminal ANSI color behaviour in bash after failure caused by user program? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741230450a2362010.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论