Link picker now shows both outgoing [[links]] and backlinks in a unified list with section headers. Backlinks follow by entity ID directly, outgoing links resolve by text. Navigating into a backlink works the same as following an outgoing link — pushes to nav stack, esc pops back.
This commit is contained in:
@@ -860,7 +860,7 @@ func (m model) updateBrowse(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
|
||||
case "[":
|
||||
if m.state == stateDetail && m.detail.entity != nil && m.detail.mode == detailPreview {
|
||||
m.linkPicker = newLinkPicker(m.detail.entity.Body)
|
||||
m.linkPicker = newLinkPicker(m.detail.entity.Body, m.detail.backlinks)
|
||||
m.state = stateLinkPicker
|
||||
return m, nil
|
||||
}
|
||||
@@ -964,14 +964,17 @@ func (m model) updateLinkPicker(msg tea.KeyMsg) (tea.Model, tea.Cmd) {
|
||||
m.state = stateDetail
|
||||
return m, nil
|
||||
case "enter":
|
||||
lt := m.linkPicker.selected()
|
||||
if lt == "" {
|
||||
item := m.linkPicker.selected()
|
||||
if item.text == "" && item.entityID == "" {
|
||||
return m, nil
|
||||
}
|
||||
if m.detail.entity != nil {
|
||||
m.navStack = append(m.navStack, m.detail.entity.ID)
|
||||
}
|
||||
return m, followLink(m.store, lt)
|
||||
if item.kind == linkBacklink {
|
||||
return m, followLinkByID(m.store, item.entityID)
|
||||
}
|
||||
return m, followLink(m.store, item.text)
|
||||
default:
|
||||
m.linkPicker = m.linkPicker.update(msg.String())
|
||||
return m, nil
|
||||
|
||||
Reference in New Issue
Block a user