mirror of
https://github.com/atuinsh/atuin.git
synced 2025-01-04 21:40:48 +01:00
Remove shortcut numbers (#708)
* Remove shortcut numbers I was also going to remove the offset so scrolling only happens at the top. But tbh, I quite like it this way. * Remove key binding
This commit is contained in:
parent
c5f96ad8b8
commit
3fdd4f4591
@ -112,14 +112,11 @@ pub const PREFIX_LENGTH: u16 = " > 123ms 59s ago".len() as u16;
|
|||||||
|
|
||||||
impl DrawState<'_> {
|
impl DrawState<'_> {
|
||||||
fn index(&mut self) {
|
fn index(&mut self) {
|
||||||
// these encode the slices of `" > "`, `" {n} "`, or `" "` in a compact form.
|
if self.y as usize + self.state.offset == self.state.selected {
|
||||||
// Yes, this is a hack, but it makes me feel happy
|
self.draw(" >> ", Style::default());
|
||||||
static SLICES: &str = " > 1 2 3 4 5 6 7 8 9 ";
|
} else {
|
||||||
|
self.draw(" ", Style::default());
|
||||||
let i = self.y as usize + self.state.offset;
|
}
|
||||||
let i = i.checked_sub(self.state.selected);
|
|
||||||
let i = i.unwrap_or(10).min(10) * 2;
|
|
||||||
self.draw(&SLICES[i..i + 3], Style::default());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn duration(&mut self, h: &History) {
|
fn duration(&mut self, h: &History) {
|
||||||
|
@ -95,7 +95,6 @@ impl State {
|
|||||||
len: usize,
|
len: usize,
|
||||||
) -> Option<usize> {
|
) -> Option<usize> {
|
||||||
let ctrl = input.modifiers.contains(KeyModifiers::CONTROL);
|
let ctrl = input.modifiers.contains(KeyModifiers::CONTROL);
|
||||||
let alt = input.modifiers.contains(KeyModifiers::ALT);
|
|
||||||
match input.code {
|
match input.code {
|
||||||
KeyCode::Char('c' | 'd' | 'g') if ctrl => return Some(RETURN_ORIGINAL),
|
KeyCode::Char('c' | 'd' | 'g') if ctrl => return Some(RETURN_ORIGINAL),
|
||||||
KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
@ -107,10 +106,6 @@ impl State {
|
|||||||
KeyCode::Enter => {
|
KeyCode::Enter => {
|
||||||
return Some(self.results_state.selected());
|
return Some(self.results_state.selected());
|
||||||
}
|
}
|
||||||
KeyCode::Char(c @ '1'..='9') if alt => {
|
|
||||||
let c = c.to_digit(10)? as usize;
|
|
||||||
return Some(self.results_state.selected() + c);
|
|
||||||
}
|
|
||||||
KeyCode::Left => {
|
KeyCode::Left => {
|
||||||
self.input.left();
|
self.input.left();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user