Skip to content

Releases

v0.18.0

Choose a tag to compare

@kenshaw kenshaw released this 03 Dec 08:15
go get github.com/xo/[email protected]

rline requires github.com/xo/inputrc v0.11.3. Each change below has a decision in docs/PLAN.md.

New in the API

  • WithMultilineEOL sets the line continuation character of a program that has no WithContinue. It is a backslash unless the program sets another, and 0 turns the rule off (D146).
  • Package ansi exports the parser of rline's style specs: SpecSGR gives the escape sequences that rline writes for a spec on a palette, SGR gives the sequences from one Attr to another, and ScanSpec and SpecWord read the words of a spec. On PaletteMono they write bold, italic, underline and reverse, and no color (D149, D150).

Fixed

  • With WithContinue, a backslash at the end of the line stays in the text, and only the program's function decides whether the line goes on. Before, rline took the backslash off and started a new row first, so echo a\ and b gave two commands, and an escaped backslash lost one of its two (D146).
  • On a dumb terminal and with horizontal-scroll-mode, rline draws what waits before each key that does not insert text, as bash does. So text typed ahead of a Tab shows before the completion moves back over it. A paste stays one draw, and a normal terminal still draws once when no keys wait (D147).

Changed

  • Session.Palette is PaletteMono also when TERM or COLORTERM says that the terminal has no color. Color stays on there, and rline writes attributes and no color. A program that wants no escape sequences checks for color off itself (D150).
  • rline keeps only finished lines in the history. bash also keeps the first row of a line that goes on (D148).

v0.17.0

Choose a tag to compare

@kenshaw kenshaw released this 03 Dec 00:56
go get github.com/xo/[email protected]

rline requires github.com/xo/inputrc v0.11.3. Each change below has a decision in docs/PLAN.md.

New in the API

  • Session.Palette returns the colors that rline writes to the terminal. It returns ansi.PaletteMono when rline writes no color: with WithColor(false), with NO_COLOR set, on a dumb terminal, and when the output is not a terminal (D140).
  • Session.Set changes options after New. It takes the history options (WithHistory, WithHistoryFile, WithHistoryLimit, WithHistoryFileLimit, WithHistoryControl, WithHistoryFilter, WithHistoryDuplicates, WithManualHistory and WithHistoryFileMode), and also WithPrompt, WithCompleter and WithHighlighter. For any other option it returns ErrNotSettable and changes nothing (D141).
  • Option is now a struct, where it was a function. A program makes an option only with the With functions, so no caller changes.

Fixed

  • On a dumb terminal, and with horizontal-scroll-mode, a line that the function of WithContinue says goes on showed "^J". rline now writes a new row and the continuation prompt, and edits the new line in its own row, as bash does. In that row, the keys stop at the newline, as they do in bash (D139, D143).
  • In a locale of single bytes, the cursor stays where the terminal put it after a byte above 0x7f. This holds in the row of horizontal-scroll-mode and after a prompt that holds such a byte (D138, D142).

Changed

  • revert-line rings the bell when there is nothing to take back, and vi's b and B ring it at the start of the line, as bash does (D143).
  • A lower history limit given to Set drops the oldest entries at once, as HISTSIZE does in bash. A new file limit takes effect at the next save (D141).

config/v0.2.0

Choose a tag to compare

@kenshaw kenshaw released this 03 Dec 00:57
go get github.com/xo/rline/[email protected]

config requires rline v0.17.0 and github.com/xo/transit/styles v0.8.0.

  • Styles.SpecLanguage(capture, language) gives the style of a capture in a language. The entry of editor.styles wins, as in Spec. Then the theme's entry for the language wins, such as keyword.postgres over keyword (D144).
  • HistoryOptions always gives the options for history.size, history.file_size and history.ignore. An empty value gives the default of rline, so Session.Set goes back to the default when a program empties a key while it runs. New behaves as before (D145).

v0.16.0

Choose a tag to compare

@kenshaw kenshaw released this 02 Dec 22:20
go get github.com/xo/[email protected]

rline requires github.com/xo/inputrc v0.11.3. Each change below has a decision in docs/PLAN.md.

New in the API

  • WithHistoryControl and HistoryControl leave lines out of the history as HISTCONTROL does in bash (D99, D103).
  • WithHistoryFilter asks a function about each line before it goes into the history, as HISTIGNORE does (D99).
  • WithHistoryFileLimit writes at most the newest n entries to the history file, as HISTFILESIZE does (D99).
  • WithInputrcLines applies lines of an inputrc file after the inputrc file itself (D100).
  • WithManualInterruptNewline leaves the newline after a line that Ctrl-C gave up to the program (D121).
  • Candidate.Mode gives the mode of the file that a completion names. A directory gets its slash from readline's mark-directories and mark-symlinked-directories (D127). Set Mode, and do not put "/" in Display or Suffix.
  • LineStyle.Edit and Edit say how the line changed since the highlighter was last called, for an incremental parser such as tree-sitter (D128).

Changed

  • WithKeepInterrupted is deprecated and does nothing. A line that Ctrl-C gives up always stays on the screen with ^C after it, as in bash (D122).
  • bash 5.3 on Linux amd64 is the reference on every Unix system (D113).
  • A locale that is not UTF-8 reads each byte as one character. In the C and POSIX locales, the four meta variables of readline take bash's values, and a byte above 0x7f is shown in octal when output-meta is off (D111, D112, D118). After such a byte, the cursor stays where the terminal put it (D137).
  • On a dumb terminal, and with horizontal-scroll-mode, rline draws one row that scrolls sideways, as readline does (D119, D126). On a dumb terminal there is no carriage return after ^C, as in bash.
  • A session that does not edit writes nothing of its own (D120).
  • rline draws the active region as readline 8.3 does (D107).
  • Each save of the history removes the temporary files that rline left beside it (D105).
  • tty-status rings the bell on every Unix system (D110).
  • keyseq-timeout sets how long rline waits for the rest of a key sequence (D98).
  • The question before a long list, Ctrl-C on a line taller than the screen, and a resize at the question follow bash (D134, D136).
  • Menu marks, tabs, braces and the width after a resize follow readline (D116, D117, D130 to D133).
  • An inputrc file gives a notice for each line that is at fault (D104, D109).
  • An unknown or limited terminfo entry keeps the escape sequences that rline wrote before (D123, D124).
  • On Windows, the console reads escape sequences from New to Close.

Also

  • rline builds with TinyGo for js/wasm, WASI preview 1 and WASI preview 2, and CI checks it (D115).
  • The config module reads the history and editor stanzas of config.yaml. It is tagged on its own, as config/v0.1.0, later (D101).
  • The MIT license of rline and of isocline is in LICENSE.

config/v0.1.0

Choose a tag to compare

@kenshaw kenshaw released this 02 Dec 22:21
go get github.com/xo/rline/[email protected]

The first release of the module github.com/xo/rline/config (D101). It reads the history and editor stanzas of config.yaml, which usql and hail share, and turns them into options of rline.

It requires rline v0.16.0, github.com/xo/hail/pattern v0.1.0 for history.ignore (D106), and github.com/xo/transit/styles v0.7.11. It needs Go 1.27.4.

v0.15.3

Choose a tag to compare

@kenshaw kenshaw released this 01 Dec 21:12
go get github.com/xo/[email protected]

rline builds with github.com/xo/inputrc v0.11.3. v0.15.2 did not build once go get -u picked inputrc v0.10.0 or later, because inputrc removed Parser.Errs.

What changed

  • rline requires inputrc v0.11.3, and reads the faults of an inputrc file from the error that the parser returns.
  • New still gives no notice for a line of the inputrc file that is at fault. A file that cannot be read gives one, as before.
  • ParseAndBind still answers ErrUnknownVariable for a variable that readline does not have.
  • inputrc v0.11.1 and later read an inputrc file more as readline 8.3 does. For example, "\C-a" end-of-line, with a space and no colon, binds \C-a as bash 5.3 does, where before it was refused.

Nothing else changed since v0.15.2.

v0.15.2

Choose a tag to compare

@kenshaw kenshaw released this 29 Nov 20:26
go get github.com/xo/[email protected]

Each row of a line after a newline can have its own prompt, as psql's
PROMPT2 draws one for each row of a statement.

What changed

  • WithRowPrompt(rowPrompt func(before string) string) gives each row that
    starts after a newline its own prompt, in place of the continuation
    marker. rline gives the function all the text before the row, the newline
    included. It asks again whenever the text changes, so an edit on an
    earlier row or a paste changes the prompts after it (D96).
  • A row that only wraps keeps the continuation marker.
  • The rows after the first all take the width of the widest prompt, and a
    narrower prompt is padded on the left, as the continuation marker is. When
    a wider prompt appears, as when the row number gains a digit, the rows
    above it move one column to the right. psql does not do that.

Nothing changes for a program that does not use the option.

v0.15.1

Choose a tag to compare

@kenshaw kenshaw released this 29 Nov 06:33
go get github.com/xo/[email protected]

rline now compiles for WASI preview 2 with TinyGo. Nothing changes on any
other system.

What changed

  • tinygo build -target=wasip2 compiles rline. TinyGo builds that target as
    linux with the build tag wasip2, and golang.org/x/sys/unix does not
    compile there. The files that import it now leave out wasip2. The target
    reads plain lines, as wasip1 does, and a program can give it a terminal
    with WithTerminal (D95).
  • CI has no TinyGo. TestNoSystemCallsUnderWASIP2 reads each build line with
    the tags that TinyGo 0.44.0 sets for wasip2, and fails when a file that the
    target takes imports golang.org/x/sys/unix.

Known limits

  • The build was checked by hand up to the link step. The link needs
    wasm-tools, which was not on the host. CI does not build with TinyGo
    (backlog 86).

v0.15.0

Choose a tag to compare

@kenshaw kenshaw released this 29 Nov 00:15
go get github.com/xo/[email protected]

The prompt is written once, rows follow readline's layout without the wrap
mark, and a function that runs at the prompt can end the line. This release
changes the signature of RunAtPrompt, which v0.14.0 brought a day ago.

What changed

  • The prompt is written once, and each draw after that moves the cursor
    past it, as readline does. A program that waits for the prompt on a
    pseudo-terminal no longer takes a copy of it for the next one (D90).
  • With WithWrapMark(false), rows follow readline's layout: a row fills the
    terminal to its edge, a row that only wraps starts at the left edge with
    no continuation marker, and a cursor at the edge goes to the next row. The
    default layout is unchanged (D91).
  • A completion that a program command queues with Line.Complete counts as
    a second press only after the same command, so Tab and that command do not
    list after each other (D92).
  • RunAtPrompt now takes func(w io.Writer) error. An error gives up the
    line, ends raw mode, and is what ReadLine returns. What else was asked
    for waits for the next line (D94). A function that returns nil works as
    before.
  • D93 corrects the reasoning of D87 about when bash runs a trap at the
    prompt. rline's behaviour does not change.

Known limits

  • In readline's layout, a resize still measures the rows as isocline lays
    them out, so a row of the old draw can stay on the screen (backlog 89).
  • The wake of RunAtPrompt on Windows is checked only by go vet
    (backlog 88).
  • The questions that are still open, and the work that is known and not
    done, are in
    docs/PLAN.md and
    docs/BACKLOG.md.

v0.14.0

Choose a tag to compare

@kenshaw kenshaw released this 28 Nov 17:18
go get github.com/xo/[email protected]

A program can run work at the prompt, and a program command can print
below the line or finish it and have the terminal. Two faults against
readline are fixed: a change that stty made at the prompt was undone at
the next line, and the end of a line drew the line again.

What changed

  • Session.RunAtPrompt(fn) runs fn while ReadLine waits for a key, as
    bash runs a trap or writes a job notice at the prompt. It is safe to call
    from any goroutine. The line goes off the screen, fn writes where it was,
    and the line is drawn again below, with the text and the cursor kept. When
    no line is read, fn runs before the next prompt (D87).
  • Line.Print(text) writes below the line and keeps the line, as bash's
    display-shell-version does. Line.AcceptAndRelease(fn) finishes the line
    as it stands and gives the terminal to fn, and ReadLine hands the line
    back with no prompt after it, as bash's edit-and-execute-command does
    (D85).
  • WithWrapMark(false) leaves out the mark at the end of a row that wraps
    (D86).
  • A command that a program command queues with Run or Complete sees the
    command before the program's, so a second press of a key that completes
    lists, and menu-complete goes on to the next completion. The line is drawn
    before a list of completions (D84).
  • Raw mode reads the terminal's settings each time, as readline does, so a
    change that stty made at the prompt stays (D88).
  • The end of a line moves the cursor to its end and writes nothing more when
    the line is drawn as it stands, as readline does. It is drawn again only
    when keys came faster than it was drawn, Ctrl-C emptied it, or a brace is
    highlighted (D89).

Known limits

  • A row that wraps ends one column before the edge, where readline fills it
    (backlog 87).
  • The wake of RunAtPrompt on Windows is checked only by go vet
    (backlog 88).
  • CI does not build with TinyGo yet (backlog 86).
  • The questions that are still open, and the work that is known and not
    done, are in
    docs/PLAN.md and
    docs/BACKLOG.md.