Skip to content

feat: migrate display to CTBase palette + move show methods to Init/Solutions#358

Merged
ocots merged 1 commit into
mainfrom
feat/display-initialguess-palette
Jun 30, 2026
Merged

feat: migrate display to CTBase palette + move show methods to Init/Solutions#358
ocots merged 1 commit into
mainfrom
feat/display-initialguess-palette

Conversation

@ocots

@ocots ocots commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

This PR refactors the display system in CTModels.jl to use the CTBase semantic palette (CTBase.Core.get_format_codes) and moves simple Base.show methods closer to their owning modules.

Changes

Phase A — InitialGuess display in Init module

  • New file: src/Init/show.jl — Base.show for InitialGuess and PreInitialGuess (both text/plain and compact forms) using the CTBase palette
  • Modified: src/Init/Init.jl — added include("show.jl") before exports
  • New test: test/suite/init/test_initial_guess_show.jl — 23 tests

Phase B — Solution display moved to Solutions module

  • New file: src/Solutions/show.jl — Base.show for Solution using the CTBase palette, with fmt.success/fmt.error for the solver success line
  • Deleted: src/Display/solution.jl — removed (logic moved to Solutions/show.jl)
  • Modified: src/Display/Display.jl — removed solution.jl include, updated docstring, added import CTBase.Core
  • Modified: src/Solutions/Solutions.jl — added include("show.jl"), updated module docstring
  • New test: test/suite/solutions/test_solution_show.jl — 15 tests

Phase C — Migrate definition.jl and mathematical.jl to palette + cleanup

  • Modified: src/Display/definition.jl — replaced _print_ansi_styled with CTBase.Core.get_format_codes (fmt.emphasis)
  • Modified: src/Display/mathematical.jl — replaced all _print_ansi_styled calls with palette codes (fmt.emphasis, fmt.keyword)
  • Modified: src/Display/ansi.jl — removed _ansi_color, _ansi_reset, _print_ansi_styled; only __print remains
  • Modified: docs/api_reference.jl — added Init/show.jl and Solutions/show.jl, removed Display/solution.jl

Architecture

The Display module now focuses exclusively on Model/PreModel rendering (which depends on MLStyle, MacroTools, and RecipesBase). Simple Base.show methods that only need CTBase.Core live in their respective modules (Init, Solutions).

Test results

All 3920 tests pass (including 38 new display tests).

…olutions

- Add Base.show for InitialGuess and PreInitialGuess in Init/show.jl
  using CTBase.Core.get_format_codes palette
- Move Base.show for Solution from Display/solution.jl to Solutions/show.jl
  with fmt.success/fmt.error for solver status
- Migrate definition.jl and mathematical.jl from _print_ansi_styled to
  CTBase palette (fmt.emphasis, fmt.keyword)
- Remove _ansi_color, _ansi_reset, _print_ansi_styled from ansi.jl
  (only __print remains)
- Add import CTBase.Core to Display module
- Update docs/api_reference.jl: add Init/show.jl and Solutions/show.jl,
  remove Display/solution.jl
- Add test suites: test_initial_guess_show.jl (23 tests) and
  test_solution_show.jl (15 tests)
- Update module docstrings in Solutions.jl and Display.jl
@ocots ocots merged commit dc9eb16 into main Jun 30, 2026
6 checks passed
@ocots ocots deleted the feat/display-initialguess-palette branch June 30, 2026 18:04
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.

1 participant