Skip to content

Commit

Permalink
fix #210: exclude current item in multi-selection
Browse files Browse the repository at this point in the history
Be compatible to fzf:
1. If multi-selection is not enabled, select current item
2. If multi-selection is enabled
    a) No item is selected -> select current item
    b) already selected some items -> exclude current item
  • Loading branch information
lotabout committed Jan 27, 2020
1 parent e33e134 commit cadeef4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,8 @@ impl Selection {

pub fn get_selected_items(&mut self) -> Vec<Arc<Item>> {
// select the current one
if !self.items.is_empty() {
let select_cursor = !self.multi_selection || self.selected.is_empty();
if select_cursor && !self.items.is_empty() {
let cursor = self.item_cursor + self.line_cursor;
let current_item = self
.items
Expand Down

0 comments on commit cadeef4

Please sign in to comment.