Use jansi terminal if available

The jansi terminal is a little nicer than the jna terminal in windows in
my opinion. In the jna terminal, tab completions use overscores instead
of inverting the colors for the highlighted completion string.
This commit is contained in:
Ethan Atkins 2020-09-21 13:25:25 -07:00
parent 036fef3383
commit 025aff625b
1 changed files with 7 additions and 2 deletions

View File

@ -46,6 +46,11 @@ private[sbt] object JLine3 {
term.disableScrolling()
term
}
private val jansi = {
val (major, minor) =
(JansiSupportImpl.getJansiMajorVersion, JansiSupportImpl.getJansiMinorVersion)
(major > 1 || minor >= 18) && Util.isWindows
}
private[util] def system: org.jline.terminal.Terminal = {
val term =
if (forceWindowsJansiHolder.get) windowsJansi()
@ -55,8 +60,8 @@ private[sbt] object JLine3 {
org.jline.terminal.TerminalBuilder
.builder()
.system(System.console != null)
.jna(Util.isNonCygwinWindows)
.jansi(false)
.jna(Util.isWindows && !jansi)
.jansi(jansi)
.paused(true)
.build()
}