Changelog
User-visible changes to github.com/ows4444/tui. The format loosely follows
Keep a Changelog 1.1.0. There is no
tagged release yet, so everything is under Unreleased.
A removed or changed exported identifier needs a - BREAKING: entry under
Unreleased that names it; see CONTRIBUTING.md.
[Unreleased]
Section titled “[Unreleased]”tui.WriteClipboard(text)copies text: the Program writes the OSC 52 sequence to its own output and keeps the text.tui.PasteCopied()delivers that text toUpdateas aPasteEvent.filepicker.Model.Errreports why the current directory could not be listed, andViewshows a line saying so. An unreadable directory used to look like an empty one.filepicker.Model.Reloadlists the directory again.ExtensionsandDirsOnlyset afterNewhad no effect on the starting directory; set them and callReload.
Changed
Section titled “Changed”- BREAKING:
textinput.Model.ClipboardWriteandtextarea.Model.ClipboardWriteno longer default toos.Stdoutwhen nil. With the field nil, Copy and Cut returntui.WriteClipboard, so the OSC 52 sequence goes to the Program’s output, and Paste returnstui.PasteCopied, so the pasted text arrives oneUpdatelater as aPasteEvent. A Model whoseUpdateis called outside a Program copies and pastes only if the caller runs the returned Cmd. - The text the paste key inserts is no longer shared by every text input in the process. It belongs to the Program, so two Programs in one process (two SSH sessions) cannot paste each other’s copies.
- Cancelling the context given to
WithContextnow endsRun: it restores the terminal and returns the context’s error. Before, onlyProgram.Contextwas cancelled andRunkept going untilQuit. Runreturns an error wrapping the write error when a write to the output fails. Before, write errors were ignored and the Program kept rendering.
Deprecated
Section titled “Deprecated”textinput.Model.ClipboardWriteandtextarea.Model.ClipboardWrite: usetui.WithOutputto direct the Program’s output. While set, the field still receives the OSC 52 sequence and Paste inserts only what that Model copied.- The chart functions in
widgets(BarChart,Gauge,HeatMap,LineChart,Sparkline,SparklineWithand theBarItemalias) moved towidgets/chart; thewidgetsversions forward to them. layout.Box.Render: uselayout.BoxNode(box, layout.Block(content)), orBoxNodewith any Node child.ansi.SetClusterWidth: use anansi.Measurerfor anything tied to one terminal. A Program no longer calls it.
Removed
Section titled “Removed”- BREAKING:
WithInputReader,WithOutputWriterandWithErrWriterare removed.WithInput,WithOutputandWithErrOutputtake any reader or writer: a non-file reader given toWithInputneeds no terminal and quits the Program at EOF, asWithInputReaderdid. - BREAKING:
WithLineRendereris removed.WithCellRenderer(false)selects the line renderer. - BREAKING:
layout.JoinHorizontal,JoinHorizontalAlign,JoinVertical,JoinVerticalAlign,FlexRow,FlexItem,GridFlex,GridandColSpecare removed. Use the Node constructors:JoinHorizontalandFlexRowbecomelayout.Row,JoinVerticalbecomeslayout.Column, the*Alignvariants setFlexChild.CrossAlignon each child,GridFlexandGridbecomelayout.GridNode,ColSpecbecomeslayout.Track, andFlexItembecomeslayout.FlexChild.
tuitest.Replaysays why it fails on a recording it cannot reproduce: one in which a tick or resize was handled between two keys that arrived in one input read. Before, the failure was only a frame diff.colorpickerpasses aPasteEventto its hex field while that field has focus. It forwarded only keys, so a paste never reached the field.Runwaits for its resize watcher before returning, so nothing asks theTerminalfor its size, or reads the output file’s descriptor, afterRunhas returned and the caller has closed the output.filepickertreats a symlink to a directory as a directory: Enter descends into it instead of selecting it as a file.Gobehaves asFromCtxdoes:Sequencewaits for aGoCmd before starting the next one, andRunCmdruns it and returns its Msg. Before,Sequencemoved on at once andRunCmdreturned an internal value.imageview: a Model fromNewencodes its image once and reuses the result until the image, size, mode, id or cell size changes. It used to decode and encode on everyView. Bytes ofPNGoverwritten in place are not noticed; assign a new slice.tuitest.Session.Keyssends every key nameKey.Stringproduces (function keys,insert, modified keys such asctrl+leftandctrl+shift+a, media keys) as that key. Before, names it did not know were typed one character at a time. An argument that is exactly a key name can no longer be typed as text withKeys.RuncancelsContextand releases callers blocked inSendwhen it returns before the loop starts (the input is not a terminal, or raw mode cannot be entered). ARuncalled while the first is still running no longer reads the running model; it returns the model given toNewProgram.SuspendMsg.Errreports a failure to re-enter raw mode after aSuspendwhose function succeeded. It was nil before, with the terminal left in its normal mode.- With
WithRecover(true), a panic in aTickorFromCtxCmd, aSequencestep or anEverycallback now makes Run return a*PanicError. Before, these restored the terminal and re-panicked.