Files
OpenShell/crates/openshell-tui
Eric Curtin 3558888091 refactor(tui): extract shared draw_text_field and draw_confirm_popup helpers (#1790)
The openshell-tui UI module had two private draw_text_field functions
with near-identical logic in create_sandbox.rs and create_provider.rs
(differing only in cursor glyph and whether a gap row is shown), and
four confirm-dialog rendering blocks duplicated across global_settings.rs
and sandbox_settings.rs.

Extract both patterns into module-level helpers in ui/mod.rs:

- draw_text_field: accepts cursor (&str) and show_gap (bool) to cover
  both callers; create_sandbox uses '█'/true, create_provider uses '_'/false.
- draw_confirm_popup: takes the already-built lines vec, a border style,
  a width, and the enclosing area, and owns the Clear + Block + Paragraph
  rendering that was duplicated in all four confirm functions.

Remove the now-redundant imports (Clear, Paragraph) from the settings
files and drop the local use super::centered_popup as centered_rect aliases
that are no longer needed.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
2026-06-07 10:26:38 -07:00
..