feat(tui): include backlinks in link picker
CI / test (pull_request) Successful in 2m25s

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:
2026-05-21 14:12:28 -04:00
parent 2684eb1d24
commit 4517b2e37c
3 changed files with 73 additions and 17 deletions
+7 -4
View File
@@ -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