Repository navigation
Conversation
Articles show their pictures (guyfedwards#99): kitty, iTerm2 or Sixel where the terminal has one, half blocks elsewhere. images: false turns it off. Links are clickable where the terminal supports OSC 8, relative links and images are resolved against the article, and the mouse wheel scrolls. Layout, keys, help and theme colours stay as they were. Adds the first TUI tests, driving the real program through uitest.
Owner
|
Hey @thebanri, thanks for the PR but not looking to move away from bubble tea. happy to accept any of the individual fixes separately though. Thanks |
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.
Closes #99.
Disclosure first: I maintain Limoni, the Go TUI library this PR moves nom onto. I picked nom because #99 is something you said you'd welcome, and doing it properly needed a renderer that can place pictures. Please treat this as a proposal. If you'd rather keep Bubble Tea, say so and I'll close it. I'm also happy to split it up or change anything below.
What changes for a reader
images: falsein the config turns all of this off, and the alt text is shown instead./blog/xbecomeshttps://go.dev/blog/x.theme.glamourstill accepts dark, light, dracula, pink, ascii and notty, using the colours glamour gives those styles.customreads the colours from the glamour style file. Margins and the##heading prefixes in the style files are not reproduced.Small differences I'd like you to look at:
12/114where the pagination dots were.h/l/PgUp/PgDn still move a page.fonly favourites. Before, it also paged down, because bubbles' viewport bindsfto page down too.E(edit config) and openers withtakeover: truereport on the status line that the terminal can't be handed to another program. Limoni can't hand the Windows console to a child process yet. I'd rather say so than hide it. Ctrl+Z was Unix-only before too.Measurements
Same machine, same SQLite database (114 items from seven real feeds served locally), and the same scripted session. The session is 41 list moves, opening a long article (the Go blog's SIMD post), 30 line scrolls, 3 page-downs, end/top, 3 next-article, back, then a filter typed, applied and cleared.
Both binaries ran in a 100×30 pty with
TERM=xterm-256color. The pty is answered by a terminal emulator (charmbracelet/x/vt), so capability queries get real answers. Each version ran three times; medians below.7f38cccwith Bubble Tea v1.2.4, bubbles v0.18.0, lipgloss v1.1.1-0.20250404, glamour v0.10.0.go build)How to read these:
images: false, so both sides render the same thing.The harness (a pty driver plus emulator, ~200 lines of Go), the raw numbers and the screenshots are on a separate branch of my fork: https://github.com/thebanri/nom/tree/limoni-preview
Tests
nom had no TUI tests. This adds eight, using Limoni's
uitest. They run the real model through the real message loop on an in-memory terminal, against an in-memory SQLite store, and drive it the way a user does: press keys, type into the filter, read rows and article text through the semantic tree.MF?, andqquittingEwithout a terminal to hand over reporting so instead of hangingimages: falsefetching nothingPlus unit tests for the colour and glamour-style mapping.
go test -race ./...passes, and so dogo vetandgofmt.It was also checked by hand in kitty 0.49.2 and in a browser through xterm.js:
Ehanding the terminal to an editor that reads a line: the editor got the whole line and nom repainted afterfgfive times in a row under bash, with keys working after eachDependencies
github.com/thebanri/limoniandgolang.org/x/image(WebP decoding).godirective moves from 1.24.0 to 1.25.0, which Limoni requires. Your CI already runs Go ≥ 1.25.Files
internal/commands/tui.go,list.go,viewport.go,key.go: the TUI, same structure and behaviour as before.internal/commands/images.go: downloads, limited to 4 at a time, 10 MB each, scaled to at most 1200 px wide.internal/commands/theme.go: glamour style names to colours.internal/commands/commands.go: the article is now Markdown for the TUI to draw, with relative URLs resolved. The store, feeds, filter logic and config are unchanged, apart from the newimageskey.README.md: the theme note and theimagesoption.