- Fixed terminal size detection in the
mordant-jvm-ffm
module on macOS (#238) - Fixed proguard filename duplication (#232)
- New
TerminalDetection
object that can be used to detect terminal capabilities without creating a terminal instance. - Added new optional methods to
TerminalInterface
to control raw mode:getTerminalSize
,readInputEvent
,enterRawMode
, andshouldAutoUpdateSize
. - Added new terminal implementation that uses the Foreign Function and Memory (FFM) API added in JDK 22.
- Split the library up into modules, so you can produce smaller JVM artifacts by only using the parts you need.
- Added support for raw mode and input events to JS and wasmJS targets when running on node.js.
- Added tvOS and watchOS native targets to all modules except the new
mordant-markdown
module. - Added ability to control raw mode with the
TerminalRecorder
. - Added support for unicode input in raw mode.
- Added
nonInteractiveWidth
andnonInteractiveHeight
toTerminal
terminal constructor to set a different width when the terminal is not interactive (e.g. when redirecting output to a file) (#140)
- Breaking Change Moved
Terminal.info.width
andheight
toTerminal.size.width
andheight
. - Breaking Change
TerminalInterface.info
is now a method with parameters instead of a property. - Breaking Change Moved
Markdown
widget to separatemordant-markdown
module, which is not included by default. If you use markdown rendering, you need to add that module to you dependencies. - Breaking Change Combined all
ColumnWidth
subclasses into a single class with factory methods. If you were usingColumnWidth.Custom
, you should now use theColumnWidth
constructor. - Breaking Change The following
Terminal
methods are now extensions:prompt()
,info()
,danger()
,warning()
,success()
,muted()
- Breaking Change Renamed
TerminalInfo.crClearsLine
tosupportsAnsiCursor
- In raw mode on POSIX systems, pressing the escape key once will now immediately return an
Escape
event. (#193) - Renamed
Terminal.info
property toTerminal.terminalInfo
. The old name is deprecated.
- Removed constructor overloads for
Terminal
. There is now one constructor with all default parameters. - Removed
Terminal.colors
. All colors rendered with the terminal are now automatically downsampled. - Removed previously deprecated methods.
- Fixed ConcurrentModificationException from progress bars when updated under very high concurrency (#204)
- Improved performance of progress bars under high concurrency. (#207)
- Fixed
NoClassDefFoundError
when running with certain gradle plugins (#217) - Fixed whitespace of aligned table captions on narrow terminals (#216)
- Fixed raw mode on macOS for JVM and native not using the correct termios constants. (#180)
- Raw mode on macOS and Linux will now report the
ESC ESC
sequence as anEscape
key event. - Fixed raw mode on GraalVM native image not compiling with musl libc. Contributed by @hubvd (#189)
- Added support for raw mode on GraalVM native image on macOS and Linux. Contributed by @hubvd (#186)
- Fix markdown rendering not supporting math blocks (#182)
- Fix exception thrown when using
readEvent
in raw mode when some windows terminals lose focus - Fix
MultiplatformSystem.readFileAsUtf8
not supporting special files on JVM on Linux
- Added raw mode support for reading keyboard and mouse events. See the docs at https://ajalt.github.io/mordant/ for details. This feature is currently supported on all targets except JS, wasmJS, and Graal Native Image.
- Added
Termianl.interactiveSelectList
,Terminal.interactiveMultiSelectList
, andInteractiveSelectListBuilder
that let you pick one or more items from a list using the arrow keys.
- Update Kotlin to 2.0.0
- Fix animations to correctly clear the last frame when animating a non-rectangular widget that changes size.
- Fix closing bold and dim styles when one is nested in the other.
- Fix
NoClassDefFoundError
in terminal detection on some platforms.
- Publish
iosArm64
andiosX64
targets. - Added
MultiplatformSystem
that provides multiplatform implementations of some non-terminal functionality that commonly used for command line apps:readEnvironmentVariable
,exitProcess
, andreadFileAsUtf8
.
- Publish
linuxArm64
andwasmJs
targets.
This release includes a complete rewrite of the progress bar system. The new system is more performant and flexible, and allows for more complex progress animations. The old progress bar APIs are deprecated, but will continue to work.
See the documentation website for more information.
- New implementation of progress bars with a number of improvements:
- Support for animating multiple progress bars at the same time.
- New
mordant-coroutines
modules with extensions for animating with coroutines instead of threads. - Any widget can be added to a progress layout, not just the built-in cell types
- Added
compact
style totimeRemaining
cells. - Added
marquee
cell that can scroll text that is larger than a fixed width. - Added
timeElapsed
cell that shows the time elapsed since the start of the animation.
- Added
Viewport
widget that can crop or pad another widget to a fixed size, and scroll it within that size. - Added
precision
parameter tocompleted
progress cell that controls the number of decimal places shown. - Animations now automatically handle the terminal resizing, although on some terminals partially drawn frames may be visible. Due to a bug in JNI, the terminal size isn't automatically updated on JVM on macOS.
- Added
TableBuilder.addPaddingWidthToFixedWidth
option to control how padding is added to fixed width columns.
- Animations now never add a trailing newline while they're running. They always add one once the animation is stopped. The
trailingLinebreak
parameter is deprecated. This allows full screen animations without a blank line at the bottom.
- Vertical layout now correctly pads non-text cells when
align
is set toTextAlign.LEFT
- Fixed exception when hiding the cursor on browsers on JS target.
- Update internal code generation to be compatible with the latest versions of R8 (#161)
- Vararg constructors for
UnorderedList
andOrderedList
UnorderedList
andOrderedList
now support being empty- Added optional terminal frame to
TerminalRecorder.outputAsHtml
- When setting conflicting styles on a
Table
or its cells, the innermost style now takes precedence (i.e. if you set different styles on the whole table and a cell, the style applied to the cell will be used).
- Updated bundled proguard rules (#130)
- Added
ColumnWidth.Custom
that allows more control over column width behavior in tables. (#109) - Added
showPulse
parameter toProgressLayout.progressBar
, allowing you to disable the pulse animation for a bar. - Added support for detecting terminal capabilities on mintty. Thanks to @sschuberth for the contribution. (#127)
- Update Kotlin to 1.9
- Use the native C API when building a native image on GraalVM, which reduces binary size and removes the need to reflection. Thanks to @hubvd for the contribution (#119)
- Fixed exception thrown in environments that are missing required shared native libraries.
- Fixed animations clearing too much space when the animation changes size while running. (#110)
- Improved terminal capability detection for Xterm terminals. (#113)
- Update Markdown parser dependency to fix crashes on native release executables
- Added
ConfirmationPrompt
that asks the user to enter the same value twice, which is commonly used for password inputs.
- Include metadata in JVM jars to support GraalVM native-image.
- Fix animations printing an extra frame after
stop
is called when running in the IntelliJ console. (#105)
- Deprecated
TerminalColors
is favor ofTextColors
andTerminal.theme
Terminal.rawPrint
which allows you to print ANSI codes manually. (#91)- Option to disable trailing line breaks on animations.
Terminal.print
,println
, andrawPrint
now accept astderr
parameter that will print to stderr (if available).
- Fix typo in enum name: renamed
Borders.TOM_BOTTOM
toBorders.TOP_BOTTOM
. (#100) - The terminal cursor will now be hidden when
progressAnimation
is running.
- Removed
TerminalRecorder.currentContent
. Usestdout()
,stderr()
oroutput()
instead. - Removed
Terminal.forStdErr()
andTerminalInterface.forStdErr()
. UseTerminal.println(stderr=true)
instead.
- Add
Animation.stop()
to stop an animation without clearing it. (#95) - Animations now support resuming after a call to
stop
orclear
. (#94) TextStyles.reset
,TextStyles.resetForeground
, andTextStyles.resetBackground
to clear existing styles.
- Fix
TerminalInfo.interactive
not includingoutputInteractive
- Fix prompts on JS targets that were broken by KT-55817
- Source-incompatible change: All boolean fields on
TextStyle
are now nullable. A null field indicates no change to the previous value when adding or nesting styles. verticalLayout{}
now defaultsTextAlign.NONE
, meaning it won't add any trailing whitespace to lines. You can return to the old behavior withalign = TextAlign.LEFT
.- When nesting styles, the outer style will now override inner styles at the start of a string. (e.g.
red(blue("x")) == red("x")
) - Definition List terms and entries can now be empty
- Switch back to calling
stty
fordetectTerminalSize
on macOS. (#86) OverflowWrap
is now properly ignored when using a non-wrappingWhitespace
value.
- Tables and other layouts can now be completely empty (#82)
- Update Kotlin to 1.8.0
- Removed JS/Legacy publication. The JS target only publishes artifacts built with the IR compiler.
- JVM: terminal detection now uses JNA to call kernel functions directly.
- Interactive state of stdin and stdout are now detected separately.
- Terminal size detection is now fast since it does not need a subprocess.
- Detect terminal correctly when running in the IntelliJ terminal tab, but not through a run action. (#76)
timeoutMs
parameter toTerminalDetection.updateTerminalSize
. This function is now fast on all platforms.
- Stop stripping trailing newline from text when using
Whitespace.PRE
(#75)
- Implemented
hideInput
for prompts on native targets (#63) - Improve cell-width calculation for emoji sequences like skin tone modifiers (#64)
- Added
Theme.plus
to combine two themes - Added
Padding.plus
to combine two padding values
- Replaced most of the
Padding
constructor andWidget.withPadding
overloads with a unified builder interface - Renamed the top level
row
andcolumn
builders tohorizonalLayout
andverticalLayout
, respectively - Update Kotlin to 1.7.20
- Kotlin/Native: use new default memory manager. Objects are no longer frozen.
- Removed
buildWidget
. UsehorizonalLayout
andverticalLayout
instead.
- Terminal detection would sometimes incorrectly identify the process as running in IntelliJ (#72)
updateTerminalSize
would sometimes fail to find thestty
command (#66)
- Functionality for reading user input:
Terminal.readLineOrNull
,Terminal.prompt
and variousPrompt
classes TerminalRecorder
that saves output to memory rather than printing it.TerminalRecorder.outputAsHtml()
that can render recorded output as an html file.
- When building tables,
borders
has been renamedcellBorders
, andouterBorder: Boolean
has been replaced withtableBorders: Borders?
, which allows more control over the table's outside borders. (#58) - Update Kotlin to 1.7.0
- Avoid clobbering output when using
Terminal.forStdErr
while an animation is running. (#54)
- Deprecated the
VirtualTerminalInterface
. UseTerminalRecorder
instead.
- Update Kotlin to 1.6.20
- Publish JS target with the IR format in addition to LEGACY
- Fix race condition when using ProgressAnimation and adding interceptors in JVM (#55)
- Progress bars and other single-line animations are now supported in the IntelliJ console (#49)
- Added
bottomTitle
toPanel
Terminal.forStdErr
for printing to stderr rather than stdout- Add
macosArm64
target for native M1 macs
- Update Kotlin to 1.6.10
- Breaking change: Renamed
Table
andPanel
'sborderStyle
property toborderType
andborderTextStyle
toborderStyle
- Breaking change: Renamed
TerminalInfo
'sstdinInteractive
andstdoutInteractive
toinputInteractive
andoutputInteractive
, respectively
- Fix regression in clearing animations (#48)
Spinner
widget that displays a looping animationEmptyEidget
widget that can be used as a placeholder in layoutsrow{}
andcolumn{}
widget layouts that create a single row/column of widgets
- Reduced flickering on high frame rate animations
- Update Kotlin to 1.5.31
- Update Colormath to 3.0. If you use and colormath colors directly, you may need to update your imports.
- Fixed exception thrown when parsing markdown tables with empty cells
- Fixed rendering of markdown image reference links and link content
- Published artifacts for macOS
- Update Kotlin to 1.5.10
- All text instances and print functions now default to preformatted whitespace, meaning that spaces and newlines will be preserved. You can explicitly pass
Whitespace.NORMAL
to restore the previous behavior.
Table.contentToCsv
to render a table's cells to csv format- Added support for JavaScript and linux native targets
- Getter properties for standard theme styles
- Update Kotlin to 1.4.31
- Improve terminal capabilities detection
Terminal.progressAnimation
builder to create a customizable progress bar animation- Improved cursor APIs and added ability to produce cursor ANSI codes as a string
- Add ability to override detected terminal interactivity separately from the ANSI capabilities (#7)
- Rework theming system to simplify customization
Mordant 2.0 is a rewrite that retains the simple APIs of Mordant 1.0, and adds support for rendering complex widgets.
- Added renderable widgets, including tables, panels, and lists
- Added markdown rendering
- Added a theme system to customize text styles on an entire terminal instance
- Added animations that automatically clear the previous frame when redrawing
- Improved terminal capability detection
- ANSI colors and styles can now be applied through the
TextColors
andTextStyles
top-level objects, andTerminal.print
will downsample th resulting strings based on the detected terminal capabilities.
- Improve support for color detection in IntelliJ and VS Code terminals
- Add functions for generating ANSI cursor movement
- Add ability to generate ANSI color codes from any colormath color object
- Update colormath to 1.2.0
- Add support for XYZ and LAB color spaces
- Initial Release