Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
harana-bot committed Feb 15, 2024
1 parent dc95f94 commit 2e37582
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,20 @@ class SearchKeyHandler extends ActionHandler(zoomTo(_.searchState)) {
event.preventDefault()
event.stopPropagation()

val hasVerticalCards = cardState.cards.nonEmpty && cardState.cards(cardState.middleHorizontalIndex).nonEmpty

key match {
case Keys.Down =>
action(if (cardState.middleVerticalIndex < cardState.cards(cardState.middleHorizontalIndex).size -1 ) SelectVerticalBottomCard else NoChange)
if (hasVerticalCards)
action(if (cardState.middleVerticalIndex < cardState.cards(cardState.middleHorizontalIndex).size -1) SelectVerticalBottomCard else NoChange)
else
action(SelectNextDocument)

case Keys.Up =>
action(if (cardState.middleVerticalIndex > 0) SelectVerticalTopCard else NoChange)
if (hasVerticalCards)
action(if (cardState.middleVerticalIndex > 0) SelectVerticalTopCard else SelectPreviousDocument)
else
action(SelectPreviousDocument)

case Keys.Left =>
action(SelectHorizontalLeftCard) + action(if (cardState.middleHorizontalIndex == 1) UpdateFocusedPanel(Panel.Document) else NoChange)
Expand All @@ -184,7 +192,7 @@ class SearchKeyHandler extends ActionHandler(zoomTo(_.searchState)) {
action(if (event.shiftKey) OpenParentFolder else Open)

case Keys.Space =>
val shouldShowPreview = if (value.selectedDocument.nonEmpty && value.allowPreview)
val shouldShowPreview = value.selectedDocument.nonEmpty && value.allowPreview
action(if (shouldShowPreview) ShowPreview(value.selectedDocument.get) else NoChange)

case _ =>
Expand Down

0 comments on commit 2e37582

Please sign in to comment.