From 4fd8a1fdfd978aff685d4a391632202be211cadc Mon Sep 17 00:00:00 2001 From: ZAN DoYe Date: Wed, 12 Aug 2026 21:23:30 +0800 Subject: [PATCH 1/2] Lterm_vi: fix prev_word' --- src/lTerm_vi.ml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/lTerm_vi.ml b/src/lTerm_vi.ml index 1dd6f84..a8e5177 100644 --- a/src/lTerm_vi.ml +++ b/src/lTerm_vi.ml @@ -340,17 +340,20 @@ module Query = struct in let prev= prev_category ~nl_as_sp ~pos ~start text in 1 + - if category_equal start_category before_start then - if is_space start_category then + if is_space start_category then + (* condition 1: start at space, prev -> prev + 1 *) + prev_category ~nl_as_sp ~pos:prev ~start text + else if prev < pos-1 then + (* condition 2: start is not the head of a word, prev + 1 *) + prev + else + let prev= prev_category ~nl_as_sp ~pos:prev ~start text in + if is_space before_start then + (* condition 3: the char before start is space, prev -> prev -> prev + 1*) prev_category ~nl_as_sp ~pos:prev ~start text else + (* condition 4: start at the head of o word, prev -> prev + 1 *) prev - else if is_space before_start then - let prev= prev_category ~nl_as_sp ~pos:prev ~start text in - if prev <= start then prev else - prev_category ~nl_as_sp ~pos:prev ~start text - else - prev_category ~nl_as_sp ~pos:prev ~start text let prev_word ?multi_line ~pos ~start text= let prev_category ~nl_as_sp= From b455d302615277e32769d2b89dc58ed1f2cb478a Mon Sep 17 00:00:00 2001 From: ZAN DoYe Date: Wed, 12 Aug 2026 21:24:35 +0800 Subject: [PATCH 2/2] release 3.4.1 --- CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index f9138e4..0958f6b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,8 @@ +3.4.1 (2026-08-12) +------------------ + +* `LTerm_vi`: fix `prev_word'`, resolve an issue that vi commands `b` words backward and `B` WORDS backward may behave improperly in some cases + 3.4.0 (2026-04-06) ------------------