Unify ANSI display formatting in Core module - #450
Merged
Conversation
- Add Core/display.jl with _apply_ansi primitives and semantic wrappers (_dim, _bold, _red, _yellow, _green) - Add Core/tags.jl with AbstractTag (moved from display.jl) - Fix get_format_codes color detection bug (supports_color = true → get(io, :color, false)) - Load Core before Exceptions in CTBase.jl (Exceptions now imports from Core) - Exceptions/display.jl uses qualified calls (Core._dim, etc.) instead of local definitions - Add test_core_display.jl with comprehensive tests for ANSI functions
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.
Summary
Centralizes all ANSI formatting utilities in
Core/display.jlto provide a single source of truth for terminal color support across the package.Changes
New files
src/Core/display.jl— ANSI formatting primitives:_apply_ansi(s, code, io::IO)— base function with color detection_dim,_bold,_red,_yellow,_greenget_format_codes(io::IO)— semantic palette for structured displaysupports_color = true→get(io, :color, false)(detection was commented out)src/Core/tags.jl— MovedAbstractTagfrom display.jl (better organization)test/suite/core/test_core_display.jl— Comprehensive tests (52 assertions):get_format_codesNamedTuple structureModified files
src/CTBase.jl— Changed load order: Core before Exceptions (was stale comment "must load first")src/Core/Core.jl— Addedinclude("display.jl")andinclude("tags.jl")src/Exceptions/Exceptions.jl— Addedusing ..Core: Corefor qualified accesssrc/Exceptions/display.jl— Removed local ANSI definitions, now uses qualified calls (Core._dim,Core._bold, etc.)Philosophy compliance
Core._diminstead ofusing ..Core: _dimTesting
All tests pass (1242/1242), including:
test_core_display.jl(52/52)test_exception_display.jl(155/155)