From 09d0efc06fe8329e841ffbdb92bde2893f4ee61d Mon Sep 17 00:00:00 2001 From: Seongjae Lee Date: Fri, 11 Sep 2015 22:43:09 -0700 Subject: [PATCH] Make the first found item to be automatically selected This is a regression caused by docquery integration (56821bccbc0294a3b9803d6f8a1c1011155233b0). indexof always returns -1. Since the selected item is always the first filtered item, we can safely set it to 1. --- lib/notational-velocity-view.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/notational-velocity-view.coffee b/lib/notational-velocity-view.coffee index 11730d7..d47be32 100644 --- a/lib/notational-velocity-view.coffee +++ b/lib/notational-velocity-view.coffee @@ -136,8 +136,7 @@ class NotationalVelocityView extends SelectListView @list.append(itemView) if selectedItem - n = filteredItems.indexOf(selectedItem) + 1 - @selectItemView(@list.find("li:nth-child(#{n})")) + @selectItemView(@list.find("li:nth-child(#{1})")) else @setError(@getEmptyMessage(@docQuery.documents.length, filteredItems.length))