diff --git a/CHANGELOG.md b/CHANGELOG.md index b822d8e..a0cf9dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed - an issue affecting some old terminals in which the escape sequences used for displaying progress bars were incorrectly printed to the console (#8) - an issue that could cause warning messages to mess up the prompt display (#5) +- an issue that prevented selecting some variants if a prompt had 10+ variants (#12) ### Changed - improved error message if channel-build fails randomly in case old files could not be removed (#6) diff --git a/src/main/scala/sc4pac/Prompt.scala b/src/main/scala/sc4pac/Prompt.scala index b0ab406..7f986dd 100644 --- a/src/main/scala/sc4pac/Prompt.scala +++ b/src/main/scala/sc4pac/Prompt.scala @@ -50,10 +50,10 @@ object Prompt { } yield { if (input.isEmpty) default else { - val matches: Seq[String] = options.filter(_.toLowerCase(java.util.Locale.ENGLISH).startsWith(input.toLowerCase(java.util.Locale.ENGLISH))) - matches match { + val inputLower = input.toLowerCase(java.util.Locale.ENGLISH) + options.filter(_.toLowerCase(java.util.Locale.ENGLISH).startsWith(inputLower)) match { case Seq(unique) => Some(unique) - case _ => None + case matches => matches.find(_ == input).orElse(matches.find(_.toLowerCase(java.util.Locale.ENGLISH) == inputLower)) } } }