feat: add Go TUI rendering and terminal helper functions

7 funciones Go del dominio tui: apply_gradient (gradiente de color en texto),
draw_box y draw_separator (renderizado de cajas y separadores con box_chars),
load_ascii_art (carga de arte ASCII desde archivos), normalize_terminal_output
y strip_ansi (limpieza de salida de terminal), read_dir_autocomplete
(autocompletado de rutas de directorio). Incluye box_chars.go como helper
de caracteres Unicode para bordes.
This commit is contained in:
2026-04-12 13:54:54 +02:00
parent 93ef4b8010
commit ebba1e4e02
15 changed files with 541 additions and 0 deletions
@@ -0,0 +1,40 @@
---
name: normalize_terminal_output
kind: function
lang: go
domain: tui
version: "1.0.0"
purity: pure
signature: "func NormalizeTerminalOutput(s string) string"
description: "Limpia output de terminal: remueve codigos ANSI, normaliza saltos de linea (CRLF/CR a LF) y elimina caracteres de control no imprimibles. Preserva tabs y newlines."
tags: [tui, terminal, normalize, clean, output, ansi]
uses_functions: [strip_ansi_go_tui]
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [strings]
params:
- name: s
desc: "output de terminal con posibles codigos ANSI y caracteres de control"
output: "string limpio con solo caracteres imprimibles, tabs y newlines"
tested: false
tests: []
test_file_path: ""
file_path: "functions/tui/normalize_terminal_output.go"
source_repo: "https://gitea-dgg044oo04woo4ggcsws4gk0.organic-machine.com/egutierrez/DevLauncher.git"
source_license: "MIT"
source_file: "launcher/core/commands.go"
---
## Ejemplo
```go
raw := "\033[32mOK\033[0m\r\nLinea 2\x00oculto"
clean := tui.NormalizeTerminalOutput(raw)
// clean == "OK\nLinea 2oculto"
```
## Notas
Preserva `\n` y `\t` como caracteres validos. Filtra todo caracter con valor < 32 (excepto tab y newline) y DEL (127). Util para capturar output de subprocesos y mostrarlo en TUIs donde los codigos ANSI rompen el render.