fix(0132): terminal_panel black bg + prompt input + cross-platform demos + e2e
terminal_panel.cpp: - BeginChild con PushStyleColor(ChildBg, negro) + PushStyleColor(Text, gris claro) - PushStyleVar(WindowPadding, 8/6px) para padding terminal real - Input prompt siempre visible cuando readonly=false - Prefijo "$ " antes del InputText (TextUnformatted + SameLine) - BeginDisabled() cuando el shell esta cerrado (en vez de ocultar el widget) - Calculo de child_h reserva exactamente GetFrameHeightWithSpacing+6 para el prompt cpp/tests/e2e/test_terminal_panel_e2e.py (nuevo): - 4 asserts: PNG existe, no todo-blanco, region oscura >= 30%, pixels no-negros >= 0.3% - Lanza primitives_gallery --capture, busca el binario Linux o Windows.exe automaticamente - Skip graceful si no hay GL ni binario (WSL/CI headless) - 4/4 pasan en Linux con LIBGL_ALWAYS_SOFTWARE=1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -240,11 +240,20 @@ void render(TerminalPanel& panel) {
|
||||
|
||||
ImGui::PopID();
|
||||
|
||||
// --- Scrollback area ---
|
||||
// --- Scrollback area — fondo negro con texto gris claro ---
|
||||
ImVec2 avail = ImGui::GetContentRegionAvail();
|
||||
float child_h = panel.readonly
|
||||
? avail.y
|
||||
: std::max(avail.y - ImGui::GetFrameHeightWithSpacing() - 4.0f, 32.0f);
|
||||
|
||||
// Reservar hueco para el input prompt si no es readonly.
|
||||
// GetFrameHeightWithSpacing() cubre una línea de InputText + padding.
|
||||
const float input_reserve = (!panel.readonly)
|
||||
? (ImGui::GetFrameHeightWithSpacing() + 6.0f)
|
||||
: 0.0f;
|
||||
float child_h = std::max(avail.y - input_reserve, 32.0f);
|
||||
|
||||
// Estilos del area terminal: fondo casi negro + texto gris claro.
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(10, 10, 10, 255));
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(220, 220, 220, 255));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8.0f, 6.0f));
|
||||
|
||||
ImGui::BeginChild("##term_scroll", ImVec2(0, child_h),
|
||||
ImGuiChildFlags_Borders,
|
||||
@@ -269,13 +278,25 @@ void render(TerminalPanel& panel) {
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
// --- Input box (si no es readonly) ---
|
||||
if (!panel.readonly && panel.is_open()) {
|
||||
ImGui::PopStyleVar(); // WindowPadding
|
||||
ImGui::PopStyleColor(2); // ChildBg + Text
|
||||
|
||||
// --- Input prompt (visible siempre que readonly=false) ---
|
||||
if (!panel.readonly) {
|
||||
// Mostrar un prefijo "$ " antes del input box.
|
||||
ImGui::TextUnformatted("$ ");
|
||||
ImGui::SameLine(0.0f, 4.0f);
|
||||
|
||||
static char s_input[1024] = {};
|
||||
ImGui::SetNextItemWidth(-1.0f);
|
||||
|
||||
// Si el shell está cerrado, desactivar el input.
|
||||
if (!panel.is_open()) ImGui::BeginDisabled();
|
||||
bool enter = ImGui::InputText("##term_input", s_input, sizeof(s_input),
|
||||
ImGuiInputTextFlags_EnterReturnsTrue);
|
||||
if (enter) {
|
||||
if (!panel.is_open()) ImGui::EndDisabled();
|
||||
|
||||
if (enter && panel.is_open()) {
|
||||
std::string cmd = std::string(s_input) + "\n";
|
||||
fn_term::send(panel, cmd);
|
||||
s_input[0] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user