Repository navigation
shellterm: a line-oriented terminal, extracted from the dashboard - #1
Merged
Merged
Conversation
Session is go-wasmcontainers/dashboard v0.8.0's vm.Terminal on go-widgets/lineedit v0.1.1, with the dashboard-specific parts turned into options: Post (was app.post), OnDone (was app.Refresh), Greeting (was the wctr greeting), and Note (was note, minus the "# dashboard:" prefix, Clean and ShowActions, which stay with the caller). Bind wires a toolkit.Terminal as the dashboard's ui/scene.go did. The tests are the dashboard's TestTerminal on a vt.Screen, under -race, at 100 % coverage. Refs go-widgets/toolkit#548 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 2 of go-widgets/toolkit#548: the line-oriented terminal shared by the go-wasmcontainers dashboard and wasmdesk.
API:
Shell:Run(ctx, line, out) (code int, clear bool).New(Options{Post, Greeting, OnDone, HistorySize}) *Session;Postis required.SetShell(Shell, lineedit.Completer),Attach(out, clear),Input,Resize,Note,History; theRunningfield is anmvvm.Observable[bool].Bind(*toolkit.Terminal, *Session, invalidate): typing goes to the session, output to the terminal, and a clear empties the screen and the scrollback.What moved, from go-wasmcontainers/dashboard v0.8.0:
vm/terminal.go'sTerminal, keeping the key goroutine, the input queue, pending writes, Ctrl-C, exit status, clear, notes and completion.ui/scene.go:400-408's wiring, which becameBind.Changed in the move:
app.postbecameOptions.Post, andapp.RefreshbecameOptions.OnDone.Options.Greeting.notebecameNote: the "# dashboard:" prefix,CleanandShowActionsstay with the caller.WctrShell,BuiltinsandWctrCompleterstay in go-wasmcontainers.Tests:
TestTerminal, on a realvt.Screenwith a serialised stand-in for the UI goroutine, plusBindtests on atoolkit.Terminaland a compiledExample.-race -count=10passes, and coverage is 100.0 % for every function.SetShellfailsTestSession(history = []).GOOS=js GOARCH=wasm,linux/386andwindowsall vet clean.Dependencies: lineedit v0.1.1, mvvm v0.15.0, and toolkit v0.362.0, which carries
Terminal.SetFont/SetCellSize(item 3, #549).CI is lineedit's, without its fuzz job. Untrusted keys and terminal bytes are parsed by lineedit, which fuzzes them in its own CI.
Refs go-widgets/toolkit#548
🤖 Generated with Claude Code