Skip to content

Commit dd8fd3d

Browse files
authored
fix: correct file tree selection after search (#61)
1 parent f319214 commit dd8fd3d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

pkg/ui/mainModel.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,14 @@ func (m mainModel) searchUpdate(msg tea.Msg) (mainModel, []tea.Cmd) {
263263
if filenode.GetFileName(f) == selected {
264264
m.cursor = i
265265
m.diffViewer, cmd = m.diffViewer.SetFilePatch(f)
266+
m.fileTree = m.fileTree.SetCursor(i)
266267
cmds = append(cmds, cmd)
267268
break
268269
}
269270
}
270271

271272
case "ctrl+n", "down":
272-
m.resultsCursor = min(len(m.files)-1, m.resultsCursor+1)
273+
m.resultsCursor = min(len(m.filtered)-1, m.resultsCursor+1)
273274
m.resultsVp.LineDown(1)
274275
case "ctrl+p", "up":
275276
m.resultsCursor = max(0, m.resultsCursor-1)

0 commit comments

Comments
 (0)