Make IDriver.Force16Colors get-only as per code review

- Changed IDriver.Force16Colors from get/set to get-only
- Simplified DriverImpl.Force16Colors implementation to remove setter
- Updated documentation to clarify Force16Colors is read-only per driver instance
- Addresses code review feedback about inconsistent interface declaration

Co-authored-by: tig <585482+tig@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-05 05:03:00 +00:00
parent 00fa3100e8
commit a81341a3b6
2 changed files with 6 additions and 6 deletions

View File

@@ -206,11 +206,7 @@ internal class DriverImpl : IDriver
public bool SupportsTrueColor => true; public bool SupportsTrueColor => true;
/// <inheritdoc/> /// <inheritdoc/>
bool IDriver.Force16Colors public bool Force16Colors => _instanceForce16Colors || !SupportsTrueColor;
{
get => _instanceForce16Colors || !SupportsTrueColor;
set => throw new InvalidOperationException ("Force16Colors is read-only per driver instance. Set Terminal.Gui.Drivers.Driver.Force16Colors static property before driver creation.");
}
/// <inheritdoc/> /// <inheritdoc/>
public bool GetForce16Colors () => _instanceForce16Colors || !SupportsTrueColor; public bool GetForce16Colors () => _instanceForce16Colors || !SupportsTrueColor;

View File

@@ -93,8 +93,12 @@ public interface IDriver
/// Will be forced to <see langword="true"/> if <see cref="IDriver.SupportsTrueColor"/> is /// Will be forced to <see langword="true"/> if <see cref="IDriver.SupportsTrueColor"/> is
/// <see langword="false"/>, indicating that the <see cref="IDriver"/> cannot support TrueColor. /// <see langword="false"/>, indicating that the <see cref="IDriver"/> cannot support TrueColor.
/// </para> /// </para>
/// <para>
/// This property is read-only. To change the Force16Colors setting, set
/// <c>Terminal.Gui.Drivers.Driver.Force16Colors</c> before creating the driver instance.
/// </para>
/// </remarks> /// </remarks>
bool Force16Colors { get; set; } bool Force16Colors { get; }
/// <summary> /// <summary>
/// Gets whether the <see cref="IDriver"/> is using 16 colors instead of TrueColors. /// Gets whether the <see cref="IDriver"/> is using 16 colors instead of TrueColors.