[2.x] fix: Fixes --no-colors setting for sbtn#8517
Conversation
|
@eed3si9n Could you please review my PR? And I'm not sure why one workflow run got failed. I think it's not related to my change, could you re-run it? |
|
Does each terminal have its own color setting? afaik sbtn just sends each character to the sbt server, like ssh. https://github.com/sbt/sbt/blob/develop/contributing-docs/01_pull_request.md#instruction-to-build-sbtn has an instruction on how to build sbtn locally. Could you post a screenshot of a local build with color turned on or off different from that of the server? |
e2201b9 to
dd2c943
Compare
Here are the results:
|
Fix client options like --no-colors being ignored
Problem
When running sbt with the client-server mode, client options like
--no-colorsare ignored. The server uses its own color settings instead of respecting each client's preferences.Related issues: #7663, #6468
Solution
In
Terminal.TerminalImpl.doWrite(), the code was using global singleton properties (Terminal.isAnsiSupported,Terminal.isColorEnabled) instead of the instance's properties (self.isAnsiSupported,self.isColorEnabled).The
NetworkTerminalcorrectly fetches the client's color settings viaterminalPropertiesQuery, but these settings were never used when formatting output becausedoWrite()checked the global singleton.Changes
Terminal.TerminalImpl.doWrite()to useself.isColorEnabledandself.isAnsiSupportedinstead ofTerminal.isColorEnabledandTerminal.isAnsiSupportedFixes #7663
Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=132382032