Repository navigation
terminal: selection highlights the background, never the glyphs (fastfetch fix) - #176
Merged
Merged
Conversation
Selecting fastfetch output turned its '#'-logo and every coloured key/value into one dark grey and flattened the ANSI-background palette strip: the renderer replaced the cell foreground with theme.selection_fg (#232627, i.e. the theme background) and painted an opaque selection background over the cell. On block-art logos whose glyph fills the whole cell that hides the highlight entirely; on ANSI text it destroys the colour. Selection must only change the background. A selected cell background is now a translucent wash of theme.selection over the original background, the foreground is left byte-identical, and HIDDEN / dark-blink cells re-derive fg from the washed background so they stay hidden. The wash also keeps ANSI background art readable instead of replacing it with a solid bar. theme.selection_fg is removed: nothing else used it. The fastfetch regression is covered by pixel tests (glyph colours, full-block art, ANSI backgrounds) and by an oracle test on the guest's own fastfetch stream: a selected frame must equal an unselected frame rendered with theme.bg = highlight in every default-background cell. The committed selection screenshot (03-scrollback) is regenerated. Without this, a text selection destroys the very content it selects.
The renderer unit test proves the pixel rule in isolation; this e2e drives the real path a user hits: the real pagh-desktop compositor on 1280x800, the real pagh-terminal binary over AF_UNIX/PDP/1, and real pointer press/motion/release delivered by the compositor. It feeds the guest's own fastfetch byte stream, screenshots the compositor before and after the drag, and asserts that every background pixel of the selected cells became the translucent selection wash while glyph pixels stayed byte-identical (no recolouring, no erased logo, no flat opaque bar). A frame captured mid-drag or a blinking cursor must not be mistaken for the result, so the test settles on two identical captures of the selected region and parks the pointer outside it. With the old selection_fg behaviour this test fails: the selected text loses its colours.
ccclosed
pushed a commit
that referenced
this pull request
Nov 22, 2026
Sync with dev=c1e80933 (#147/#175/#176/#178: console grid from real framebuffer, scrollback/selection, rubberband fullscreen, os-identity, docs). Conflict: src/test.rs only — both sides appended routines/modules at the same two places. Resolution keeps BOTH: - dev qbug2 "console::text grid matches the framebuffer resolution" (console_grid_tests) and the USB "usb::BOT/SCSI/uevent layouts and /usb root rule" (usb_storage_prop_tests); - both modules are present and closed; all_tests registers 126 routines. All USB S1 files are untouched by these dev changes, and the dev framebuffer/console/scrollback/selection/os-identity work is preserved verbatim. AGENTS.md auto-merged and keeps the USB S1 gap text. Post-merge evidence: gates 6/6 (host 885/0), QEMU usb-storage acceptance 46/46, release-kernel selftest 126 routines / 0 failed / 1 skipped (NVMe absent), in one flocked run.
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.
Баг
Выделение мышью вывода
fastfetchв окнеpagh-terminalстирает картинку итекст: цветной
#-логотип и цветные пары key/value становятся однотоннымтёмно-серым, полоса цветовых фонов (ANSI 40..47/100..107) — сплошным синим
прямоугольником.
Корень
rust-apps/pagh-terminal/src/render.rs::resolve_styleна выделенной клеткеделал
bg = theme.selection(непрозрачно) иfg = theme.selection_fg(
#232627— ровно цвет фона темы).fastfetchрисует логотип ANSI-цветнымиглифами
#, а палитру — ANSI-фонами: подмена foreground в цвет фона убираетвсе цвета, непрозрачный фон затирает фоновый арт. Damage/static layer ни при
чём — пока выделение активно,
FrameSnapshot::damageвсегда отдаётFull(так было и до фикса).
Фикс
bg = bg.lerp(theme.selection, SELECTION_BG_MIX = 0.6); foreground не трогается.HIDDEN/тёмная фазаBLINKпересчитываются после подсветки (fg = bg),чтобы скрытый текст не проявлялся.
Theme::selection_fgудалён (потребителей в дереве нет).TERMINAL.mdописывает семантику.Тесты
render.rs: цвет глифов сохраняется, полнотельные блоки не затираются,ANSI-фоны остаются различимыми, hidden-текст остаётся скрытым.
tests/render_png.rs: оракул на реальном выводе fastfetch с гостя(
tests/fixtures/fastfetch-guest.script, serial-лог qbug3) — кадр свыделением пиксель-в-пиксель равен кадру без выделения с
theme.bg = подсветкаво всех клетках с дефолтным фоном.tests/selection_live.rs: живой e2e — настоящий композитор (host build),настоящий бинарник по PDP/1, настоящие press/motion/release; PNG до/после
и пиксельные проверки.
screenshots/03-scrollback.png(в нём есть selection).Evidence
.cache/pagh-agent-notes/qbug4-live/(не коммитится):live-before.png,live-after.png— окно реального композитора до/послепротяжки: логотип, текст и цвета целы, изменился только фон подсветки;
headless-*.png— то же без chrome, включаяheadless-selection-OLD-BUG.png(старый бинарник).
Гейты
pagh-terminal: 152 теста, 0 failed.pagh-ui: 140 тестов, 0 failed.rustfmt --checkпо затронутым файлам — чисто.rust-apps/out/pagh-terminal(без INTERP),pagh-uiсобирается под
x86_64-unknown-linux-musl.Координация
PR #167 (
feat/term-ux-lifecycle) трогаетrender.rsтолько добавлениемCanvas::set_pixel_rgba— пересечения сresolve_styleнет; при мерже #167ветку ребейзить. Base =
dev, мерж не делаю.