Ajuste para paginación y ajuste a terminal por defecto de 24x80
This commit is contained in:
1 parent
74b7a0c448
commit
fe1962e892
2 files changed
+38
-9
No files matched your search
Binary file not shown.
+38
-9
@@ -97,7 +97,30 @@ func (m Model) View() string {
|
|||||||
s += fmt.Sprintf("│ %-21s │ %-40s │\n", "", msgEmpty)
|
s += fmt.Sprintf("│ %-21s │ %-40s │\n", "", msgEmpty)
|
||||||
s += "└───────────────────────┴──────────────────────────────────────────┘\n"
|
s += "└───────────────────────┴──────────────────────────────────────────┘\n"
|
||||||
} else {
|
} else {
|
||||||
for i, row := range m.rows {
|
// --- VENTANA DESLIZANTE REDUCIDA A 6 FILAS PARA TERMINALES DE 24 LÍNEAS ---
|
||||||
|
maxVisibleRows := 6
|
||||||
|
startIdx := 0
|
||||||
|
endIdx := len(m.rows)
|
||||||
|
|
||||||
|
if len(m.rows) > maxVisibleRows {
|
||||||
|
startIdx = m.cursor - (maxVisibleRows / 2)
|
||||||
|
if startIdx < 0 {
|
||||||
|
startIdx = 0
|
||||||
|
}
|
||||||
|
endIdx = startIdx + maxVisibleRows
|
||||||
|
if endIdx > len(m.rows) {
|
||||||
|
endIdx = len(m.rows)
|
||||||
|
startIdx = endIdx - maxVisibleRows
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if startIdx > 0 {
|
||||||
|
s += fmt.Sprintf("│ ... (%d elementos más arriba) │\n", startIdx)
|
||||||
|
s += "├───────────────────────┼──────────────────────────────────────────┤\n"
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := startIdx; i < endIdx; i++ {
|
||||||
|
row := m.rows[i]
|
||||||
displayProj := row.Project
|
displayProj := row.Project
|
||||||
if displayProj == "(raíz)" {
|
if displayProj == "(raíz)" {
|
||||||
displayProj = ""
|
displayProj = ""
|
||||||
@@ -124,18 +147,24 @@ func (m Model) View() string {
|
|||||||
|
|
||||||
s += lineContent + "\n"
|
s += lineContent + "\n"
|
||||||
|
|
||||||
if i < len(m.rows)-1 {
|
if i < endIdx-1 {
|
||||||
s += "├───────────────────────┼──────────────────────────────────────────┤\n"
|
s += "├───────────────────────┼──────────────────────────────────────────┤\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if endIdx < len(m.rows) {
|
||||||
|
s += "├───────────────────────┼──────────────────────────────────────────┤\n"
|
||||||
|
s += fmt.Sprintf("│ ... (%d elementos más abajo) │\n", len(m.rows)-endIdx)
|
||||||
|
}
|
||||||
|
|
||||||
s += "└───────────────────────┴──────────────────────────────────────────┘\n"
|
s += "└───────────────────────┴──────────────────────────────────────────┘\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ruta completa seleccionada
|
// Ruta completa seleccionada (compacta)
|
||||||
if len(m.rows) > 0 {
|
if len(m.rows) > 0 {
|
||||||
selected := m.rows[m.cursor]
|
selected := m.rows[m.cursor]
|
||||||
fullRef := fmt.Sprintf("%s:%s", selected.RepoName, selected.Tag)
|
fullRef := fmt.Sprintf("%s:%s", selected.RepoName, selected.Tag)
|
||||||
s += fmt.Sprintf(" Ruta completa: %s\n", fullNameStyle.Render(fullRef))
|
s += fmt.Sprintf("Ruta: %s\n", fullNameStyle.Render(fullRef))
|
||||||
} else {
|
} else {
|
||||||
s += "\n"
|
s += "\n"
|
||||||
}
|
}
|
||||||
@@ -143,11 +172,11 @@ func (m Model) View() string {
|
|||||||
total := len(m.rows)
|
total := len(m.rows)
|
||||||
statusInfo := fmt.Sprintf("Total: %d imágenes (%s)", total, modeStr)
|
statusInfo := fmt.Sprintf("Total: %d imágenes (%s)", total, modeStr)
|
||||||
if m.statusMsg != "" {
|
if m.statusMsg != "" {
|
||||||
statusInfo = " " + successStyle.Render("✔ "+m.statusMsg)
|
statusInfo = successStyle.Render("✔ " + m.statusMsg)
|
||||||
}
|
}
|
||||||
s += fmt.Sprintf("%-70s\n\n", statusInfo)
|
s += fmt.Sprintf("%-70s\n", statusInfo)
|
||||||
|
|
||||||
// Barra de botones inferior estilo MC uniforme para ambos modos
|
// Barra de botones inferior estilo MC
|
||||||
btnR := footerKeyStyle.Render(" R ") + footerDescStyle.Render(" Registry ")
|
btnR := footerKeyStyle.Render(" R ") + footerDescStyle.Render(" Registry ")
|
||||||
btnL := footerKeyStyle.Render(" L ") + footerDescStyle.Render(" Local ")
|
btnL := footerKeyStyle.Render(" L ") + footerDescStyle.Render(" Local ")
|
||||||
btnT := footerKeyStyle.Render(" t ") + footerDescStyle.Render(" Tagear ")
|
btnT := footerKeyStyle.Render(" t ") + footerDescStyle.Render(" Tagear ")
|
||||||
@@ -156,9 +185,9 @@ func (m Model) View() string {
|
|||||||
btnQ := footerKeyStyle.Render(" q ") + footerDescStyle.Render(" Salir ")
|
btnQ := footerKeyStyle.Render(" q ") + footerDescStyle.Render(" Salir ")
|
||||||
|
|
||||||
if m.mode == ModeLocal {
|
if m.mode == ModeLocal {
|
||||||
s += fmt.Sprintf(" %s %s %s %s %s %s\n", btnR, btnL, btnP, btnT, btnD, btnQ)
|
s += fmt.Sprintf("%s %s %s %s %s %s", btnR, btnL, btnP, btnT, btnD, btnQ)
|
||||||
} else {
|
} else {
|
||||||
s += fmt.Sprintf(" %s %s %s %s %s\n", btnR, btnL, btnT, btnD, btnQ)
|
s += fmt.Sprintf("%s %s %s %s %s", btnR, btnL, btnT, btnD, btnQ)
|
||||||
}
|
}
|
||||||
|
|
||||||
return s
|
return s
|
||||||
|
|||||||
Reference in new issue
Block a user