-
-
Notifications
You must be signed in to change notification settings - Fork 334
Adding minimal support for Plan9 #810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@gdamore the PR is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general this looks pretty good, and thank you for doing this. I cannot attest to it actually working, so I hope you've done that.
I have a reservation about the console_stub.go change, please see my comments there to double check if that's really what you meant to do. If it is, I'd like to get a better explanation behind it.
(Basically "console" is a Windows thing in tcell, so I am surprised if any non windows platforms want anything besides the stub... it seems like you're using the tty support modified for plan 9, which looks reasonable based on your comments.)
@gdamore thank you for the review. i have reversed the |
@gdamore |
No. I will merge this as soon as I am back on my personal laptop.
• Garrett
…On Aug 19, 2025 at 8:16 PM -0700, Dan Mushkevych ***@***.***>, wrote:
mushkevych left a comment (gdamore/tcell#810)
@gdamore
I was wondering if there are any pending concerns preventing from merging this PR.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks for this.
plan9: add minimal Plan 9 backend for tcell (raw
/dev/cons
, resize via/dev/wctl
, terminfo screen)Summary
This PR introduces limited Plan 9 support for
tcell
behind build tags, enabling tcell-based applications (e.g., tview/cview) to compile and run on Plan 9 undervt(1)
(VT100 emulator). The implementation uses Plan 9’s native console and window-control files to provide raw input, output, and resize notifications, while reusing tcell’s existing terminfo screen path.Scope: No behavioral changes on non-Plan9 platforms. Public API is unchanged except for Plan 9–specific implementations.
Motivation
Upstream currently documents Plan 9 as unsupported. This PR provides a clean, low-risk baseline that:
//go:build plan9
,Technical Overview
New/updated files (Plan 9 only)
tty_plan9.go
Opens
/dev/cons
(read/write) for console I/O.Toggles raw mode by writing
"rawon"
/"rawoff"
to/dev/consctl
.Listens for resize events by blocking on
/dev/wctl
.Implements
Tty
interface, lifecycle (Start/Stop/Close
) with idempotency:stopCh
and re-opens/dev/wctl
on resume.WindowSize()
honorsTCELL_LINES/TCELL_COLS
andLINES/COLUMNS
; defaults to 80×24:tscreen_plan9.go
Plan 9 constructor:
Plan 9 initializer:
Ensures
t.tty
is set duringScreen.Init()
:Note: We do not redefine
screen.go::NewScreen()
.charset_plan9.go
getCharset()
returning"UTF-8"
(Plan 9 is built around Unicode, using UTF-8 system-wide - the encoding invented at Bell Labs by Ken Thompson and Rob Pike while they, alongside other Plan 9 pioneers, were developing the system).Architecture & Data Flow
/dev/cons
in raw mode → tcell input decoder (UTF-8)./dev/cons
, interpreted byvt(1)
(VT100)./dev/wctl
; on change, invokeNotifyResize
callback;WindowSize()
returns rows/cols via env or default.Compatibility & Risk
//go:build plan9
.Known Limitations (Plan 9)
vt(1)
(TERM=vt100
), expect monochrome (VT100 typically lacks ANSI color). If another terminal on Plan 9 provides ANSI/xterm capabilities andTERM
is set accordingly, terminfo can enable more features.vt(1)
does not emit xterm mouse/paste sequences; adding support would require a terminal that does, plus glue in the Plan 9 TTY path.LINES/COLUMNS
(orTCELL_LINES/TCELL_COLS
) with a default 80×24. We do not compute rows/cols from pixel geometry;/dev/wctl
resize is handled as an event trigger only.GOOS=plan9
) in CI (if added). No runtime tests on Plan 9 yet.Testing
Docker one-shot build