mirror of https://github.com/sbt/sbt.git
Fix sbt init menu
Problem ------- sbt init menu doesn't pick the right template in the latter half. Solution -------- This fixes the mapping between the position and the letter.
This commit is contained in:
parent
44d35b5502
commit
7c7576843a
|
|
@ -183,7 +183,7 @@ private[sbt] object TemplateCommandUtil {
|
||||||
else
|
else
|
||||||
ITerminal.withStreams(true, false) {
|
ITerminal.withStreams(true, false) {
|
||||||
val mappingList = templates.zipWithIndex.map {
|
val mappingList = templates.zipWithIndex.map {
|
||||||
case (v, idx) => nonMoveLetters(idx).toString -> v
|
case (v, idx) => toLetter(idx) -> v
|
||||||
}
|
}
|
||||||
val out = term.printStream
|
val out = term.printStream
|
||||||
out.println("")
|
out.println("")
|
||||||
|
|
@ -194,10 +194,13 @@ private[sbt] object TemplateCommandUtil {
|
||||||
mappings.get(ans).map(_._1).toList
|
mappings.get(ans).map(_._1).toList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private def toLetter(idx: Int): String =
|
||||||
|
nonMoveLetters(idx).toString
|
||||||
|
|
||||||
private def askTemplate(mappingList: List[(String, (String, String))], focus: Int): String = {
|
private def askTemplate(mappingList: List[(String, (String, String))], focus: Int): String = {
|
||||||
val msg = "Select a template"
|
val msg = "Select a template"
|
||||||
displayMappings(mappingList, focus)
|
displayMappings(mappingList, focus)
|
||||||
val focusValue = ('a' + focus).toChar.toString
|
val focusValue = toLetter(focus)
|
||||||
if (!isAnsiSupported) ask(msg, focusValue)
|
if (!isAnsiSupported) ask(msg, focusValue)
|
||||||
else {
|
else {
|
||||||
val out = term.printStream
|
val out = term.printStream
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue