Skip to content

REPL: supply a contrasting history region foreground - #63237

Open
abhinav-phi wants to merge 2 commits into
JuliaLang:masterfrom
abhinav-phi:fix-63101-hover-inverse
Open

abhinav-phi wants to merge 2 commits into
JuliaLang:masterfrom
abhinav-phi:fix-63101-hover-inverse

Conversation

@abhinav-phi

@abhinav-phi abhinav-phi commented Sep 17, 2026

Copy link
Copy Markdown

The history searcher applies the background-only :region face to hovered content, which can leave terminal-default dark text against a dark selection background. This PR supplies a contrasting foreground fallback locally in the history display, without changing the shared region defaults.

The original commit added :inverse, but that swaps the same color pair and does not establish better contrast. Commit fcd37f52b2 replaces that approach. The fallback chooses black or white from the resolved region background's relative luminance and sits beneath existing syntax annotations and the final configured region face. Explicit syntax colors and customized region foregrounds therefore retain precedence. The candidate row, age decoration, and hovered selected-preview content use the same helper. The change does not force reverse video; a user-configured inverse value remains respected.

Verification

The checkout's modified display.jl was explicitly loaded into REPL.History using a portable Windows Julia nightly, version 1.14.0-DEV.3247, runtime commit 272aa7e2a0f6786b6c5a0d3cd6e7619386e01222. This was not a full Julia build from this branch.

  • The complete checkout stdlib/REPL/test/history.jl passed 200 assertions, including 15 new checks for fallback colors, custom foreground/background/inverse preservation, syntax-color preservation, and rendered candidate output.
  • The same 200 assertions passed with --compiled-modules=no --check-bounds=yes --startup-file=no and JULIA_TEST_FAILFAST=1.
  • A negative control substituting the original region-plus-inverse styling failed the new fallback assertion. This tests the old styling behavior, not a separately built old commit.
  • A direct comparison loaded display.jl from old PR head 21fb35facd and the corrected checkout in separate runtime processes. Both rendered the same selected hovered row with a region background of #636363. Resolving their emitted ANSI colors against black-on-white terminal defaults gives plain-text contrast of 3.495:1 before and 6.008:1 after; against white-on-black defaults it remains 6.008:1. This is a color calculation for the tested plain-text case, not visual terminal verification or a guarantee for customized syntax palettes.
  • git diff --check passed before commit.

The full REPL suite was attempted with bounds checking but stopped in replcompletions.jl:1356: Windows denied creation of a self-referencing symbolic link with EPERM. It did not complete. No interactive WezTerm or iTerm2 verification, light/dark terminal screenshots, or full source build is claimed. The helper preserves explicit syntax colors rather than guaranteeing contrast for every possible user palette.

CI and review limitations

The previous head's Buildkite checks failed. The LLVM test log shows a malformed plugin-library argument followed by a load failure; the macOS test log shows a REPL worker segmentation fault. Neither failure has a base-commit comparison establishing that it is unrelated to this PR. The earlier categorical claim that those failures were unrelated or environmental was too strong. New-head CI and maintainer review remain necessary.

The REPL-local scope is a proposal, not an approved maintainer decision. No backport is included. This contribution used substantial AI assistance, including the follow-up implementation and test work; the follow-up commit discloses ZCode (Union Alpha).

Fixes #63101.

The history searcher paints the hovered candidate row and the preview-box selection with the :region face, which only sets a background. Terminals that leave the foreground at its default render dark text on the dark region background, unreadable on light backgrounds.

Applying :inverse alongside :region flips the foreground with the background, so the hovered content contrasts on both light and dark terminals. Reverse video (SGR 7) is universally supported, preserving terminal compatibility. The mode hint already combined region with inverse; this extends the same treatment to the candidate row, its age decoration, and the preview-box selection.

Fixes JuliaLang#63101.

Assisted-by: OpenCode (opencode/muse-spark-1.3-contributor-free)
@abhinav-phi

abhinav-phi commented Sep 17, 2026

Copy link
Copy Markdown
Author

Hi, this update adds the REPL-local inverse-based fix for #63101.

I applied region plus inverse at the hovered candidate row, the age decoration, and the preview-box sites. The shared region default is unchanged, and no backport is included.

I could not run Julia or terminal checks locally, so the PR lists manual verification steps for light and dark backgrounds and still needs CI plus reviewer checks. Thanks.

Related issue: #63101

@abhinav-phi

Copy link
Copy Markdown
Author

Hi eschnett and fingolfin, this PR is ready for review whenever convenient.

Two notes on the failing CI, from the attached logs. The llvmpasses failure (53 of 54) is a missing LLVM plugin library path in the test infrastructure, and this PR contains no C++ or LLVM changes, so it is unrelated. The macos-test run passed 69.7M tests with the sole error being a REPL worker segfault in the LineEdit prompt error-printing path (a typemap crash while printing an error, with objcache errors on the same worker), which sits outside the touched history-display code and looks environmental rather than related to this change.

No backport is included. Please let me know if you read the REPL failure differently, want the job re-run, or would like any changes. Thanks.

Reverse video exchanges the same low-contrast color pair. Supply a background-aware fallback beneath existing syntax styling and the configured region face, without forcing inverse video or changing the shared region defaults.

Fixes JuliaLang#63101.

Assisted-by: ZCode (Union Alpha)
@abhinav-phi abhinav-phi changed the title REPL: pair hover :region face with :inverse in history search REPL: supply a contrasting history region foreground Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New history searcher is unreadable on light terminal backgrounds

1 participant