Releases: varabyte/kotter
v1.2.1
This release is functionally identical to 1.2.0 but has some tweaks that makes the internals of the input system much more robust.
In other words, there's no urgency to update, but there should be no harm, either.
Background
For users, Kotter 1.2.0 works just fine. But there are a handful of milliseconds where the input system takes some time to hook itself up - some tricky coroutine / flow setup. Again, humans using your kotter application would never notice this!
But if you're trying to write tests that send keypresses at tremendously fast rates, then they might sneak a few keypresses in that were getting dropped very occasionally.
After spending a week investigating this, we now have an implementation system under the hood that is much more robust, so even blazingly fast tests shouldn't be able to sneak keypresses past it. Despite this benefit, the code is actually slightly more straightforward than it was before.
At the same time, there is an additional benefit where Kotter section
s will now only pay for the cost of handling input if that section is using input APIs (such as input
, onKeyPressed
, etc.).
Before, the first section you ran that used an input API would spin up some state that would remain alive for the remainder of your application. This is nothing significant that any application should ever worry about, but still, from a technical perspective, the lifecycle of input state is now a lot more sensible (and the code easier to reason about).
Thanks
Huge thanks to users @Nereboss and @phanlezz. After reporting #114, which raised an issue about occasional flakes they were seeing in tests (side note: awesome effort by these developers to write such comprehensive tests!), both users showed a ton of patience and understanding as it took me a long time to both figure the issue out and even get time to look into it deeply in the first place.
They provided excellent repro examples and were very active in coordinating on the issue thread.
Check out their GitHub project, Codecharta! It's extremely well tested!
Thanks to these two developers, I feel so much better about Kotter's input system now.
Full Changelog: v1.2.0...v1.2.1
v1.2.0
Technically, this release does not add any major features on top of 1.1.2, but due to issues with the CI failing to work with really old versions of the JDK, we bumped up the Kotlin / JDK versions a bit.
kotter1_2.mov
Changes
- Made a handful of improvements to the testing library, including adding its own README
- Introduced
InMemoryTerminal
, which collects all ANSI output into a queryable memory buffer instead of rendering it directly into the terminal.- Also exposed a convenient
buildAnsiLines
utility method which works by creating anInMemoryTerminal
behind the scenes.
- Also exposed a convenient
- Updated Kotlin to 1.9.10 / JDK to 11
Full Changelog: v1.1.2...v1.2.0
v1.1.2
This release introduces the very powerful grid widget into Kotter.
In other words, you can create tables in Kotter now. 🎉
section {
// A grid with two columns, each with space for 6 characters
grid(Cols(6, 6), characters = GridCharacters.CURVED) {
cell { textLine("Cell1") }
cell { textLine("Cell2") }
cell { textLine("Cell3") }
cell { textLine("Cell4") }
// Jump over cell row=2,col=0
cell(row = 2, col = 1) { textLine("Cell6") }
}
}.run()
Be sure to review the Grid section in the README as there are a bunch of other features discussed in there, such as fit- and star-sized columns, row and column spanning cells, and more.
Release notes
- New grid widget(!!!)
- Fixed a bug where a
session
wouldn't correctly shut down its key input processing when finished.- This would result in a first session unexpectedly interfering with a second session if one was started later before exiting the application.
- If you check the
width
value when using the virtual terminal, it now returns the width that the terminal was constructed with, notInt.MAX_VALUE
.
Full Changelog: v1.1.1...v1.1.2
Thanks!
HUGE thanks to @grnt426 for their support around grids. They initiated progress on the feature and provided a ton of real-world testing using an impressive project they are working on. I mean, just look at this:
v1.1.1
The biggest change of this release is the new multilineInput
method, which lets a user type in input with newlines.
section {
black(isBright = true) { text("Send a text message (press CTRL-D when finished)") }
multilineInput()
}.runUntilInputEntered {
onInputEntered { sendMessage(input.trim()) }
}
You can press arrow keys / home+end / page up+down to navigate around the answer. In order to allow this, the multiline input area always begins on a newline and ends with a newline.
- Add the new
multilineInput
, which is better described above. - Tweaked repaint logic. Hopefully this means no more flickering on Windows if the amount of text being rendered doesn't fit on the screen.
- Now using the current terminal's height to only erase lines that are visible on screen.
- Improve logic around auto-wrap handling, especially with non-ASCII (e.g. Chinese character) text
- Add a new
customFormat
parameter (toinput
andmutlilineInput
) which can be used to change text color / add text effects to user input as they type it.- This could be useful, for example, to highlight invalid characters that the user typed in, coloring them red.
- Misc. improvements to the test library for writing readable tests
Full Changelog: v1.1.0...v1.1.1
v1.1.0
🎉 🎉 🎉 Kotter 1.1.0 introduces Kotlin/Native support. 🎉 🎉 🎉
In other words, you can now target the JVM or you can compile against 64-bit Linux, Mac, or Windows hosts directly via the Kotlin multiplatform plugin. Review the README on how to set this up.
If you have an application that is using v1.0.x, be sure to follow all steps in the migration doc. It should be relatively straightforward.
v1.1.0-rc4
Hopefully getting close to a v1.1.0 release. Maybe this is the one! 🤞
This release adds the following changes:
Kotlin/Native
- Native terminals will now throw an exception if they aren't run in an interactive environment
- Such as a legacy terminal (like win7 cmd), or if the program is run indirectly by another (like Gradle), or if the program's stdin/stdout sources are not TTYs (e.g.
kotter-app < input.txt
is not allowed) - This behavior is now identical to the JVM system terminal
- Such as a legacy terminal (like win7 cmd), or if the program is run indirectly by another (like Gradle), or if the program's stdin/stdout sources are not TTYs (e.g.
- Fixed a case in Linux/Mac where the "hide cursor" command wasn't getting picked up
All targets
- Added new
runFor(duration)
extension methods, so you can now write:section { ... }.runFor(5.seconds)
- Convenient if you just want to render an animation for a little while.
section { ... }.runForAtLeast(5.seconds) { ... }
- Like
runFor
but doesn't aggressively abort in case you're still doing more work after the time runs out.
- Like
section { ... }.runForAtMost(5.seconds) { ... }
- Convenient if you want to cap some long running operation, such as a download for example.
Test
- Added new
assertMatches
test method, which prints a clear error message if your Kotter output doesn't match what's expected.
v1.1.0-rc3
Two additional fixes in this release:
- Avoid appending some extra newlines when the program is shutting down.
- [Windows] Fix an issue where Kotter wouldn't process ANSI commands if you ran it in a legacy Windows console host (due to incorrect setup values).
- In other words, instead of clean Kotter behavior, you got text interlaced with bizarre commands like [OK and [1F
Note that this release changes K/N targets only. If you are using v1.1.0-rc1 (or rc2) to target the JVM, then this release will be identical.
v1.1.0-rc2
This release is the same as v1.1.0-rc1 except with one bug fixed: repainting was broken whenever any line ended up being longer than the width of your terminal, leaving old text around. (There was an issue calculating how many lines needed to be erased caused by the fact that one line got broken up into two)
Note that this bug affected K/N targets only. If you are using v1.1.0-rc1 to target the JVM, then this release will be identical.
v1.1.0-rc1
The 1.1.0 version brings Kotter into the world of multiplatform, adding Kotlin/Native support.
This is a prerelease build, as I'm hoping to get community confirmation, especially about the native targets. But if you're a JVM user, it should be relatively safe to upgrade. |
---|
This means, in addition to JVM ☕ support, you can also build binaries directly for Windows 🪟 , Mac 🍎 , and Linux 🐧 platforms.
If you are new to Kotter, just jump into the README! If you are a 1.0.x user, you should review the migration steps. (They're not that bad)
This release also introduces a new onShutdownHook
feature (since I had to implement a bunch of work around this for multiplatform anyway). You can read more here if curious.
Finally, a bit overdue, but I added a section to the README about distributing your Kotter application. It's a little minimal at the moment, since it's hard to capture everything relevant about this, but I'm looking for feedback. Feel free to email me if you found it helpful, not helpful, somewhat helpful but missing something, etc.
Thank you!
v1.0.2
Very minor release, which reduces the JVM requirement back to 8.
At some point in development, the JVM version got set to 11 for some temporary experimentation I was doing. However, that later ended up getting dropped, but I forgot that I could set the version back down to 8 again.
Otherwise, this release is identical to 1.0.1.