-
Notifications
You must be signed in to change notification settings - Fork 0
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
shortcut to select line and move down #1
Comments
You can go to next and previous page using |
what i mean is, we have to select each line in two steps. first we get down to next line by pressing 'j'. After that we need to press 'space' key to select that line. If a shortcut key (like 'tab' key) is provided to move and select at the same time, we can select multiple lines with ease. |
I'd like to see this feature implemented in the console-rs/dialoguer library, but the The change would be probably in 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;
}
}
...
} We can ask them if this change would be accepted there. |
Issue asking if they are open to accepting this change console-rs/dialoguer#272 |
I modified the library to test how this feature would work and it is available in the https://github.com/urbanogilson/lineselect/tree/1-shortcut-to-select-line-and-move-down branch. You can see if this is what you expect |
tab behaviour working as intended. text file showing output of terminal is attached. |
It's great to hear that the behavior is as expected! However, please keep in mind that there might still be some corner cases that the current implementation might not cover. I'm eagerly awaiting input from the maintainers of dialoguer before making a final decision here. |
to select larger area of text, it will be better to have option to select the line and move down rather than moving to each line and selecting it. is there any option to do so?
The text was updated successfully, but these errors were encountered: