Render the generic setting-edit text-input overlay. Both the global-settings and sandbox-settings panes show the same editor overlay — an input box with the setting key/type in the title, an error line when validation fails, and `[Enter]`/`[Esc]` hints. This function is the single implementation; each pane resolves its own entry and then delegates here.
(
frame: &mut Frame<'_>,
key: &str,
kind: openshell_core::settings::SettingValueKind,
edit: &SettingEditState,
area: Rect,
theme: &Theme,
)
| 533 | /// is the single implementation; each pane resolves its own entry and then |
| 534 | /// delegates here. |
| 535 | fn draw_setting_edit_overlay( |
| 536 | frame: &mut Frame<'_>, |
| 537 | key: &str, |
| 538 | kind: openshell_core::settings::SettingValueKind, |
| 539 | edit: &SettingEditState, |
| 540 | area: Rect, |
| 541 | theme: &Theme, |
| 542 | ) { |
| 543 | let t = theme; |
| 544 | let title = format!(" Edit: {} ({}) ", key, kind.as_str()); |
| 545 | let mut lines = vec![ |
| 546 | Line::from(Span::styled(&title, t.heading)), |
| 547 | Line::from(""), |
| 548 | Line::from(vec![ |
| 549 | Span::styled("Value: ", t.muted), |
| 550 | Span::styled(&edit.input, t.text), |
| 551 | Span::styled("_", t.accent), |
| 552 | ]), |
| 553 | ]; |
| 554 | |
| 555 | if let Some(ref err) = edit.error { |
| 556 | lines.push(Line::from("")); |
| 557 | lines.push(Line::from(Span::styled(err.as_str(), t.status_err))); |
| 558 | } |
| 559 | |
| 560 | lines.push(Line::from("")); |
| 561 | lines.push(Line::from(vec![ |
| 562 | Span::styled("[Enter]", t.key_hint), |
| 563 | Span::styled(" Confirm ", t.muted), |
| 564 | Span::styled("[Esc]", t.key_hint), |
| 565 | Span::styled(" Cancel", t.muted), |
| 566 | ])); |
| 567 | |
| 568 | let popup_height = u16::try_from(lines.len() + 2).unwrap_or(u16::MAX); |
| 569 | let popup = centered_popup(50, popup_height, area); |
| 570 | frame.render_widget(Clear, popup); |
| 571 | |
| 572 | let block = Block::default() |
| 573 | .borders(Borders::ALL) |
| 574 | .border_style(t.border_focused) |
| 575 | .padding(Padding::horizontal(1)); |
| 576 | |
| 577 | frame.render_widget(Paragraph::new(lines).block(block), popup); |
| 578 | } |
| 579 | |
| 580 | /// Draw a labeled text input field. |
| 581 | /// |
no test coverage detected