on master help sign in
Add pseudo_pending for t/T/f/F (#4062)
commit9d1793c45b22a6dce0a08937717887189b46c492 authorMatt Freitas-Stavola <mbStavola@users.noreply.github.com> dateSun 2 Oct 2022, 12:32 (4 years ago) parent8c2cc43
1 file changed+19−10
helix-term/src/commands.rs+19−10
helix-term/src/commands.rs+19−10
@@ -1086,18 +1086,27 @@ fn extend_next_long_word_end(cx: &mut Context) {
10861086 extend_word_impl(cx, movement::move_next_long_word_end)
10871087}
10881088
1089−fn will_find_char<F>(cx: &mut Context, search_fn: F, inclusive: bool, extend: bool)
1090−where
1089+fn will_find_char<F>(
1090+ cx: &mut Context,
1091+ search_fn: F,
1092+ inclusive: bool,
1093+ extend: bool,
1094+ pseudo_pending: &str,
1095+) where
10911096 F: Fn(RopeSlice, char, usize, usize, bool) -> Option<usize> + 'static,
10921097{
10931098 // TODO: count is reset to 1 before next key so we move it into the closure here.
10941099 // Would be nice to carry over.
10951100 let count = cx.count();
10961101
1102+ cx.editor.pseudo_pending = Some(pseudo_pending.to_string());
1103+
10971104 // need to wait for next key
10981105 // TODO: should this be done by grapheme rather than char? For example,
10991106 // we can't properly handle the line-ending CRLF case here in terms of char.
11001107 cx.on_next_key(move |cx, event| {
1108+ cx.editor.pseudo_pending = None;
1109+
11011110 let ch = match event {
11021111 KeyEvent {
11031112 code: KeyCode::Enter,
@@ -1200,35 +1209,35 @@ fn find_prev_char_impl(
12001209}
12011210
12021211fn find_till_char(cx: &mut Context) {
1203− will_find_char(cx, find_next_char_impl, false, false)
1212+ will_find_char(cx, find_next_char_impl, false, false, "t")
12041213}
12051214
12061215fn find_next_char(cx: &mut Context) {
1207− will_find_char(cx, find_next_char_impl, true, false)
1216+ will_find_char(cx, find_next_char_impl, true, false, "f")
12081217}
12091218
12101219fn extend_till_char(cx: &mut Context) {
1211− will_find_char(cx, find_next_char_impl, false, true)
1220+ will_find_char(cx, find_next_char_impl, false, true, "t")
12121221}
12131222
12141223fn extend_next_char(cx: &mut Context) {
1215− will_find_char(cx, find_next_char_impl, true, true)
1224+ will_find_char(cx, find_next_char_impl, true, true, "f")
12161225}
12171226
12181227fn till_prev_char(cx: &mut Context) {
1219− will_find_char(cx, find_prev_char_impl, false, false)
1228+ will_find_char(cx, find_prev_char_impl, false, false, "T")
12201229}
12211230
12221231fn find_prev_char(cx: &mut Context) {
1223− will_find_char(cx, find_prev_char_impl, true, false)
1232+ will_find_char(cx, find_prev_char_impl, true, false, "F")
12241233}
12251234
12261235fn extend_till_prev_char(cx: &mut Context) {
1227− will_find_char(cx, find_prev_char_impl, false, true)
1236+ will_find_char(cx, find_prev_char_impl, false, true, "T")
12281237}
12291238
12301239fn extend_prev_char(cx: &mut Context) {
1231− will_find_char(cx, find_prev_char_impl, true, true)
1240+ will_find_char(cx, find_prev_char_impl, true, true, "F")
12321241}
12331242
12341243fn repeat_last_motion(cx: &mut Context) {