Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Tab to select line and move down #272

Open
urbanogilson opened this issue Aug 14, 2023 · 1 comment
Open

Feature: Tab to select line and move down #272

urbanogilson opened this issue Aug 14, 2023 · 1 comment

Comments

@urbanogilson
Copy link

The Tab behavior is already defined in multi_select.rs#L249, but the change would likely be in match term.read_key() redefining the behavior of Key::Tab and Key::BackTab to select and move to the next line or back and unselect respectively e.g.

match term.read_key()? {
    Key::Tab => {
        checked[sel] = !checked[sel];
        if sel == !0 {
            sel = 0;
        } else {
            sel = (sel as u64 + 1).rem(self.items.len() as u64) as usize;
        }
    }
    Key::BackTab => {
        if sel == !0 {
            sel = self.items.len() - 1;
        } else {
            sel = ((sel as i64 - 1 + self.items.len() as i64)
                % (self.items.len() as i64)) as usize;
        }
        checked[sel] = !checked[sel];
    }
    Key::ArrowDown | Key::Char('j') => {
        if sel == !0 {
            sel = 0;
        } else {
            sel = (sel as u64 + 1).rem(self.items.len() as u64) as usize;
        }
    }
    Key::ArrowUp | Key::Char('k') => {
        if sel == !0 {
            sel = self.items.len() - 1;
        } else {
            sel = ((sel as i64 - 1 + self.items.len() as i64)
                % (self.items.len() as i64)) as usize;
        }
    }
...
}

Is the project open to changing this behavior?

@pksunkara
Copy link
Collaborator

That's not how the tab shortcut is generally used AFAIK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants