Sync UI path fallbacks during main landing
This commit is contained in:
@@ -232,6 +232,11 @@ func newUIWithState(mode string, sess appstate.CurrentSession) *ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *ui) filter() {
|
func (u *ui) filter() {
|
||||||
|
if len(u.state.CurrentPath) == 0 && len(u.currentPath) > 0 {
|
||||||
|
u.state.CurrentPath = append([]string(nil), u.currentPath...)
|
||||||
|
} else {
|
||||||
|
u.currentPath = append([]string(nil), u.state.CurrentPath...)
|
||||||
|
}
|
||||||
u.state.SearchQuery = u.search.Text()
|
u.state.SearchQuery = u.search.Text()
|
||||||
visible, err := u.state.VisibleEntries()
|
visible, err := u.state.VisibleEntries()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -282,18 +287,21 @@ func (u *ui) selectedAttachmentNames() []string {
|
|||||||
func (u *ui) showEntriesSection() {
|
func (u *ui) showEntriesSection() {
|
||||||
u.state.Section = appstate.SectionEntries
|
u.state.Section = appstate.SectionEntries
|
||||||
u.state.NavigateToPath(nil)
|
u.state.NavigateToPath(nil)
|
||||||
|
u.currentPath = nil
|
||||||
u.filter()
|
u.filter()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *ui) showTemplatesSection() {
|
func (u *ui) showTemplatesSection() {
|
||||||
u.state.Section = appstate.SectionTemplates
|
u.state.Section = appstate.SectionTemplates
|
||||||
u.state.NavigateToPath(nil)
|
u.state.NavigateToPath(nil)
|
||||||
|
u.currentPath = nil
|
||||||
u.filter()
|
u.filter()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *ui) showRecycleBinSection() {
|
func (u *ui) showRecycleBinSection() {
|
||||||
u.state.Section = appstate.SectionRecycleBin
|
u.state.Section = appstate.SectionRecycleBin
|
||||||
u.state.NavigateToPath(nil)
|
u.state.NavigateToPath(nil)
|
||||||
|
u.currentPath = nil
|
||||||
u.filter()
|
u.filter()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+5
-2
@@ -234,12 +234,15 @@ func (u *ui) handleShortcutKey(name key.Name, modifiers key.Modifiers) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *ui) activateBreadcrumb(index int) {
|
func (u *ui) activateBreadcrumb(index int) {
|
||||||
|
var path []string
|
||||||
if index <= 0 {
|
if index <= 0 {
|
||||||
u.state.NavigateToPath(nil)
|
path = nil
|
||||||
} else {
|
} else {
|
||||||
crumbs := u.breadcrumbLabels()
|
crumbs := u.breadcrumbLabels()
|
||||||
u.state.NavigateToPath(append([]string{}, crumbs[1:index+1]...))
|
path = append([]string{}, crumbs[1:index+1]...)
|
||||||
}
|
}
|
||||||
|
u.currentPath = append([]string(nil), path...)
|
||||||
|
u.state.NavigateToPath(path)
|
||||||
u.filter()
|
u.filter()
|
||||||
if index >= len(u.breadcrumbLabels()) {
|
if index >= len(u.breadcrumbLabels()) {
|
||||||
index = len(u.breadcrumbLabels()) - 1
|
index = len(u.breadcrumbLabels()) - 1
|
||||||
|
|||||||
Reference in New Issue
Block a user