joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.78k stars 381 forks source link

LS command causes to change the color of the output back to default #5243

Open d1m4s1k opened 1 week ago

d1m4s1k commented 1 week ago

Describe the bug

I want to change the color of the screen text and after that list the files in the current directory but it happens to reset the color back to white which is default. I suppose it occurs because of the using the ls command that highlights some files with colors. image

Steps to reproduce the behaviour

  1. Type "color 0a"
  2. Type "ls"

Expected behavior

The color of the text had not changed

What operating system(s) this bug have occurred on?

Windows 10 HSL

What version(s) of DOSBox-X have this bug?

V2024.10.01, Visual Studio SDL1 64-bit

Used configuration

No response

Output log

No response

Additional information

No response

Have you checked that no similar bug report(s) exist?

Code of Conduct & Contributing Guidelines

joncampbell123 commented 1 week ago

I don't know about this. ANSI codes don't provide a way to read back state to restore it later. On my Linux system, ls --color will reset any attributes I set on the terminal prior to it. It makes logical sense that "ls" would have the same limitation: Resets the attribute to normal white on exit.

Unless standard DOS somehow allows "ls" to restore the attribute exactly as it was, it would be better for your program/script to re-apply the ANSI attributes it needs after running "ls".

joncampbell123 commented 1 week ago

What I mean is, if MS-DOS ANSI.SYS provides no way to save/restore attributes in that way, then neither should DOSBox-X.