Skip to content
Merged

3.4.1 #128

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -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)
------------------

Expand Down
19 changes: 11 additions & 8 deletions src/lTerm_vi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
Loading