Varabyte Konsole Versions Save

A declarative, Kotlin-idiomatic API for writing dynamic console applications.

v1.1.2

3 months ago

This release introduces the very powerful grid widget into Kotter.

In other words, you can create tables in Kotter now. :tada:

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()

image

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, not Int.MAX_VALUE.

Full Changelog: https://github.com/varabyte/kotter/compare/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:

image

v1.1.1

9 months ago

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()) }
}

Code sample in action

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 (to input and mutlilineInput) 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: https://github.com/varabyte/kotter/compare/v1.1.0...v1.1.1

v1.1.0

1 year ago

:tada: :tada: :tada: Kotter 1.1.0 introduces Kotlin/Native support. :tada: :tada: :tada:

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

1 year ago

Hopefully getting close to a v1.1.0 release. Maybe this is the one! :crossed_fingers:

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
  • 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.
    • 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

1 year ago

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

1 year ago

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

1 year ago

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 :coffee: support, you can also build binaries directly for Windows :window: , Mac :apple: , and Linux :penguin: 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

1 year ago

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.

v1.0.1

1 year ago

This is a very small release, adding support for CTRL-C on Windows where it didn't previously work.

v1.0.0

1 year ago

Announcing: the first stable release of Kotter :tada: :tada: :tada:

At this point, Kotter provides a core API for writing dynamic CLIs that is:


Outside of documentation changes, there were a handful of API changes that snuck in since v1.0.0-rc3, gaps I noticed when poring over the API docs:

  • TextAnims no longer implement CharSequence.
    • The original decision was causing its API to expose additional properties that were unnecessarily confusing (e.g. length means the length of the text for that frame, not the length of the animation.)
    • If, after upgrading, you get a compile error that text(myTextAnim) in your project, simply right-click on it and import the new extension method that fixes it. Or, change it to text("$myTextAnim") as another alternative.
  • Added a new shiftRight { ... } method, which takes any text rendered in the block and prepends all lines with spaces.
  • Added the minWidth property to the justified method
    • So you can now do justified(CENTER, minWidth = 10) { text("Hi") }
  • Animation changes
    • Allow pausing animations via the paused property
    • Provide the looping parameter when creating animations, so that you can define one-shot animations.
    • Added a few other properties for querying the state of animations: totalDuration, isRunning, and lastFrame
  • Fixed a crash in the virtual terminal you could get clicking on a blank line.