kotter
kotter copied to clipboard
Windows Virtual Terminal Incorrectly Sizes Border
Describe the bug Virtual terminals on Windows 10 incorrectly calculate the length of bordered text, causing the header and footer to be shorter than expected.
To Reproduce
build.gradle.kts
plugins {
kotlin("jvm") version "1.9.0"
application
}
dependencies {
implementation("com.varabyte.kotter:kotter-jvm:1.1.1")
}
kotlin {
jvmToolchain(17)
}
application {
mainClass.set("MainKt")
}
Main.KT
session{
section {
bordered {
textLine("Hello World!")
textLine("Row 2!")
}
}.run()
}
Expected behavior After bundling the above application into a jar and executing it on Powershell 7.4.1, I see the below
┌────────────┐
│Hello World!│
│Row 2! │
└────────────┘
┌──┐
│AA│
│b │
└──┘
Screenshots
When running inside a virtual terminal launched from IntelliJ, or forcibly launched from the Jar with the session(terminal = VirtualTerminal.create()) option, it renders with incorrect length calculated for the header and footer.
Desktop (please complete the following information):
- OS: Windows 10 64bit
- Java 17
- Kotlin 1.9.0
- Kotter 1.1.1
- IntelliJ
- Gradle 8.2
** Additional Notes:** I included the text from Powershell as it formatted and displayed correctly, however I couldn't get the text copied out of the virtual terminal (is that possible?), so included only screenshots. I can include screenshots of the correct Powershell 7 behavior if requested.
I'm not sure I can do anything about that, unfortunately. I recommend the ASCII border set in that case, or changing the font?
How can the font of a VirtualTerminal be selected? I don't see the option inside VirtualTerminal, Session, or Section.
@grnt426 https://github.com/varabyte/kotter/blob/62173802985117c8e6e53dc2b7b533cbdcf7daf2/kotter/src/jvmMain/kotlin/com/varabyte/kotter/terminal/virtual/VirtualTerminal.kt#L92
@grnt426 did you ever resolve this issue on your end, with the recommendation for changing the font?
I too have this issue. I don't know what to set the font to. It wants a path.
@ShawSumma it's been a while. I believe you put a ttf inside your resources for and the path is to that file, relative to the resource root. So probably something like "fonts/ex.ttf"
Thanks for the suggestion. That sounds right.