Skip to content

Commit ba59118

Browse files
committed
fix: issues due to rebasing
1 parent cf87ce3 commit ba59118

7 files changed

Lines changed: 16 additions & 21 deletions

File tree

src/core/commands.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,6 @@ impl Debug for Command {
124124
Self::AddInputBinding(et, _) => write!(f, "AddInputBinding({et:?})"),
125125
Self::RemoveInputBinding(et) => write!(f, "RemoveInputBinding({et:?})"),
126126
Self::FollowOutput(follow_output) => write!(f, "FollowOutput({follow_output:?})"),
127-
Self::AddKeyBinding(desc, _, remap) => write!(f, "AddKeyBinding({desc:?}, {remap})"),
128-
Self::AddMouseBinding(desc, _, remap) => {
129-
write!(f, "AddMouseBinding({desc:?}, {remap})")
130-
}
131-
Self::RemoveKeyBinding(desc) => write!(f, "RemoveKeyBinding({desc:?})"),
132-
Self::RemoveMouseBinding(desc) => write!(f, "RemoveMouseBinding({desc:?})"),
133127
Self::Io(c) => write!(f, "Io({c:?})"),
134128
}
135129
}

src/input/definitions/keydefs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl Default for KeySeq {
6060
/// # Panics
6161
/// This function will panic if the description is not valid. See the [`input`](crate::input) module
6262
/// docs on how to write descriptions.
63+
#[must_use]
6364
pub fn parse_key_event(text: &str) -> KeyEvent {
6465
let token_list = super::parse_tokens(text);
6566

src/input/definitions/mousedefs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ static MOUSE_ACTIONS: LazyLock<HashMap<&str, MouseEventKind>> = LazyLock::new(||
3030
/// # Panics
3131
/// This function will panic if the description is not valid. See the [`input`](crate::input) module
3232
/// docs on how to write descriptions.
33+
#[must_use]
3334
pub fn parse_mouse_event(text: &str) -> MouseEvent {
3435
let token_list = super::parse_tokens(text);
3536
gen_mouse_event_from_tokenlist(&token_list, text)

src/input/hashed_event_register.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ impl Hash for EventWrapper {
9090
pub struct HashedEventRegister(HashMap<EventWrapper, EventReturnType, RandomState>);
9191

9292
impl Default for HashedEventRegister {
93-
/// Create a new [HashedEventRegister] with the default hasher and insert the default bindings
93+
/// Create a new [`HashedEventRegister`] with the default hasher and insert the default bindings
9494
fn default() -> Self {
9595
let mut event_register = Self::new();
9696
super::generate_default_bindings(&mut event_register);
@@ -102,7 +102,7 @@ impl Default for HashedEventRegister {
102102
// GENERAL FUNCTIONS
103103
// ####################
104104
impl HashedEventRegister {
105-
/// Create a new HashedEventRegister with the Hasher `s`
105+
/// Create a new `HashedEventRegister`
106106
pub fn new() -> Self {
107107
Self(HashMap::new())
108108
}

src/input/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ pub(crate) fn generate_default_bindings(map: &mut HashedEventRegister) {
218218
map.map_mouse(&["scroll:down"], |_, ps| {
219219
InputEvent::UpdateUpperMark(ps.upper_mark.saturating_add(5))
220220
});
221-
map.add_mouse_events(&["left:down"], |ev, _| {
221+
map.map_mouse(&["left:down"], |ev, _| {
222222
let Event::Mouse(MouseEvent { column, row, .. }) = ev else {
223223
unreachable!();
224224
};
225225
InputEvent::StartSelection { x: column, y: row }
226226
});
227-
map.add_mouse_events(&["left:drag"], |ev, _| {
227+
map.map_mouse(&["left:drag"], |ev, _| {
228228
let Event::Mouse(MouseEvent { column, row, .. }) = ev else {
229229
unreachable!();
230230
};
@@ -233,8 +233,8 @@ pub(crate) fn generate_default_bindings(map: &mut HashedEventRegister) {
233233

234234
#[cfg(feature = "clipboard")]
235235
{
236-
map.add_mouse_events(&["left:up"], |_, _| InputEvent::CopySelection);
237-
map.add_key_events(&["y"], |_, _| InputEvent::CopySelection);
236+
map.map_mouse(&["left:up"], |_, _| InputEvent::CopySelection);
237+
map.map_keys(&["y"], |_, _| InputEvent::CopySelection);
238238
}
239239

240240
map.map_keys(&["c-s-h", "c-h"], |_, ps| {

src/search.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -896,16 +896,15 @@ pub(crate) fn nth_match(
896896
(_, SearchMode::Unknown) => unreachable!(),
897897
};
898898

899-
let mut start_idx = nearest_idx.unwrap_or(0) as isize;
900-
let match_pos = if jump == 0 {
901-
start_idx as usize
902-
} else {
899+
let mut start_idx = nearest_idx.unwrap_or(0).cast_signed();
900+
if jump > 0 {
903901
start_idx += jump - 1;
904-
start_idx = start_idx % (search_idx.len() as isize);
905-
start_idx as usize
906-
};
902+
} else if jump < 0 {
903+
start_idx += jump + 1;
904+
}
907905

908-
Some(match_pos)
906+
start_idx %= search_idx.len().cast_signed();
907+
Some(start_idx.cast_unsigned())
909908
}
910909

911910
#[cfg(test)]

src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
LineNumbers,
99
error::{MinusError, TermError},
1010
hooks::{Hook, Hooks},
11-
input::{self, HashedEventRegister},
11+
input::HashedEventRegister,
1212
minus_core::{
1313
self, CommandQueue,
1414
utils::{

0 commit comments

Comments
 (0)