Refine transfer UX and active-pane selection rendering
This commit is contained in:
parent
5a5923099b
commit
874a5ed678
3 changed files with 5 additions and 16 deletions
|
|
@ -42,9 +42,9 @@ func DefaultKeyMap() KeyMap {
|
||||||
Down: key.NewBinding(key.WithKeys("down", "j"), key.WithHelp("↓/j", "down")),
|
Down: key.NewBinding(key.WithKeys("down", "j"), key.WithHelp("↓/j", "down")),
|
||||||
PageUp: key.NewBinding(key.WithKeys("pgup", "b"), key.WithHelp("PgUp/b", "page up")),
|
PageUp: key.NewBinding(key.WithKeys("pgup", "b"), key.WithHelp("PgUp/b", "page up")),
|
||||||
PageDown: key.NewBinding(key.WithKeys("pgdown", "f"), key.WithHelp("PgDn/f", "page down")),
|
PageDown: key.NewBinding(key.WithKeys("pgdown", "f"), key.WithHelp("PgDn/f", "page down")),
|
||||||
Open: key.NewBinding(key.WithKeys("enter", "right", "l"), key.WithHelp("Enter", "open")),
|
Open: key.NewBinding(key.WithKeys("enter", "right"), key.WithHelp("Enter", "open")),
|
||||||
Back: key.NewBinding(key.WithKeys("backspace", "left", "h"), key.WithHelp("←", "parent")),
|
Back: key.NewBinding(key.WithKeys("backspace", "left"), key.WithHelp("←", "parent")),
|
||||||
Switch: key.NewBinding(key.WithKeys("tab"), key.WithHelp("Tab", "switch pane")),
|
Switch: key.NewBinding(key.WithKeys("tab", "h", "l"), key.WithHelp("Tab/h/l", "switch pane")),
|
||||||
Refresh: key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "refresh")),
|
Refresh: key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "refresh")),
|
||||||
DirSize: key.NewBinding(key.WithKeys(" "), key.WithHelp("Space", "dir size")),
|
DirSize: key.NewBinding(key.WithKeys(" "), key.WithHelp("Space", "dir size")),
|
||||||
Copy: key.NewBinding(key.WithKeys("f5", "c"), key.WithHelp("F5/c", "copy")),
|
Copy: key.NewBinding(key.WithKeys("f5", "c"), key.WithHelp("F5/c", "copy")),
|
||||||
|
|
|
||||||
|
|
@ -461,9 +461,6 @@ func (m Model) View() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
parts := make([]string, 0, 3)
|
parts := make([]string, 0, 3)
|
||||||
if m.cfg.UI.ShowTitleBar {
|
|
||||||
parts = append(parts, renderTitleBar(m))
|
|
||||||
}
|
|
||||||
parts = append(parts, panels)
|
parts = append(parts, panels)
|
||||||
if m.cfg.UI.ShowFooter {
|
if m.cfg.UI.ShowFooter {
|
||||||
parts = append(parts, renderFooter(m))
|
parts = append(parts, renderFooter(m))
|
||||||
|
|
@ -1065,9 +1062,6 @@ func (m *Model) layoutWidths() (int, int, int) {
|
||||||
|
|
||||||
func (m *Model) bodyHeight() int {
|
func (m *Model) bodyHeight() int {
|
||||||
height := m.height
|
height := m.height
|
||||||
if m.cfg.UI.ShowTitleBar {
|
|
||||||
height--
|
|
||||||
}
|
|
||||||
if m.cfg.UI.ShowFooter {
|
if m.cfg.UI.ShowFooter {
|
||||||
height--
|
height--
|
||||||
}
|
}
|
||||||
|
|
@ -1776,9 +1770,6 @@ func (m *Model) mouseTarget(x, y int) (PaneID, int, bool) {
|
||||||
|
|
||||||
leftWidth, previewWidth, rightWidth := m.layoutWidths()
|
leftWidth, previewWidth, rightWidth := m.layoutWidths()
|
||||||
top := 0
|
top := 0
|
||||||
if m.cfg.UI.ShowTitleBar {
|
|
||||||
top++
|
|
||||||
}
|
|
||||||
bodyHeight := m.bodyHeight()
|
bodyHeight := m.bodyHeight()
|
||||||
if y < top || y >= top+bodyHeight {
|
if y < top || y >= top+bodyHeight {
|
||||||
return "", 0, false
|
return "", 0, false
|
||||||
|
|
@ -1854,9 +1845,6 @@ func (m *Model) mouseOverPreview(x, y int) bool {
|
||||||
|
|
||||||
leftWidth, previewWidth, _ := m.layoutWidths()
|
leftWidth, previewWidth, _ := m.layoutWidths()
|
||||||
top := 0
|
top := 0
|
||||||
if m.cfg.UI.ShowTitleBar {
|
|
||||||
top++
|
|
||||||
}
|
|
||||||
bodyHeight := m.bodyHeight()
|
bodyHeight := m.bodyHeight()
|
||||||
if y < top || y >= top+bodyHeight {
|
if y < top || y >= top+bodyHeight {
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,8 @@ func renderPaneRows(pane BrowserPane, cfg config.Config, palette theme.Palette,
|
||||||
lines := make([]string, 0, visibleHeight)
|
lines := make([]string, 0, visibleHeight)
|
||||||
for idx := pane.Offset; idx < end; idx++ {
|
for idx := pane.Offset; idx < end; idx++ {
|
||||||
entry := pane.Entries[idx]
|
entry := pane.Entries[idx]
|
||||||
row := renderEntryRow(entry, cfg, width, idx == pane.Cursor, idx == hoverIndex, active, palette, background)
|
isSelected := idx == pane.Cursor && active
|
||||||
|
row := renderEntryRow(entry, cfg, width, isSelected, idx == hoverIndex, active, palette, background)
|
||||||
lines = append(lines, row)
|
lines = append(lines, row)
|
||||||
}
|
}
|
||||||
for len(lines) < visibleHeight {
|
for len(lines) < visibleHeight {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue