From 1b25710cf26ccc46485c9475e33980a5490b9561 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 8 Jul 2022 17:48:01 -0400 Subject: [PATCH] fix installer partly applying color theme before it's selected --- docs/release-notes.md | 3 +++ src/SMAPI.Installer/InteractiveInstaller.cs | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index cf237a82..6c3edb77 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -8,6 +8,9 @@ --> ## Upcoming release +* For players: + * Fixed Linux/macOS installer's color theme question partly unreadable if the terminal background is dark. + * For the web UI: * Added log parser warning about performance of PyTK 1.23.0 or earlier. diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index fd1a6047..d00a5df4 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -206,7 +206,7 @@ namespace StardewModdingApi.Installer Console.WriteLine(); // handle choice - string choice = this.InteractivelyChoose("Type 1 or 2, then press enter.", new[] { "1", "2" }); + string choice = this.InteractivelyChoose("Type 1 or 2, then press enter.", new[] { "1", "2" }, printLine: Console.WriteLine); switch (choice) { case "1": @@ -629,22 +629,22 @@ namespace StardewModdingApi.Installer } /// Interactively ask the user to choose a value. - /// A callback which prints a message to the console. + /// A callback which prints a message to the console. /// The message to print. /// The allowed options (not case sensitive). /// The indentation to prefix to output. - private string InteractivelyChoose(string message, string[] options, string indent = "", Action? print = null) + private string InteractivelyChoose(string message, string[] options, string indent = "", Action? printLine = null) { - print ??= this.PrintInfo; + printLine ??= this.PrintInfo; while (true) { - print(indent + message); + printLine(indent + message); Console.Write(indent); string? input = Console.ReadLine()?.Trim().ToLowerInvariant(); if (input == null || !options.Contains(input)) { - print($"{indent}That's not a valid option."); + printLine($"{indent}That's not a valid option."); continue; } return input;