Skip to content

Commit

Permalink
Fix the region to delete with 'x', 'X', 'S' in visual block state.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukamachi committed Oct 9, 2023
1 parent 32ec205 commit 19469d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
12 changes: 6 additions & 6 deletions extensions/vi-mode/commands.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -277,18 +277,18 @@
(indent-points start end))

;; FIXME: support block
(define-operator vi-substitute (beg end) ("<r>")
(define-operator vi-substitute (beg end type) ("<R>")
(:motion vi-forward-char)
(vi-delete beg end :inclusive)
(vi-delete beg end type)
(change-state 'insert))

(define-operator vi-delete-next-char (beg end) ("<r>")
(define-operator vi-delete-next-char (beg end type) ("<R>")
(:motion vi-forward-char)
(vi-delete beg end :inclusive))
(vi-delete beg end type))

(define-operator vi-delete-previous-char (beg end) ("<r>")
(define-operator vi-delete-previous-char (beg end type) ("<R>")
(:motion vi-backward-char)
(vi-delete beg end :exclusive))
(vi-delete beg end type))

(define-operator vi-delete (start end type) ("<R>")
(:move-point nil)
Expand Down
17 changes: 16 additions & 1 deletion extensions/vi-mode/tests/operator.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,22 @@
(deftest vi-delete-next-char
(with-fake-interface ()
(with-vi-buffer ("")
(ok (not (signals (cmd "x")))))))
(ok (not (signals (cmd "x")))))
(with-vi-buffer (#?"[g]et-param\nget-option\n")
(cmd "<C-v>f-jx")
(ok (buf= #?"[p]aram\noption\n")))))

(deftest vi-delete-previous-char
(with-fake-interface ()
(with-vi-buffer (#?"[g]et-param\nget-option\n")
(cmd "<C-v>f-jX")
(ok (buf= #?"[p]aram\noption\n")))))

(deftest vi-substitute
(with-fake-interface ()
(with-vi-buffer (#?"[g]et-param\nget-option\n")
(cmd "<C-v>f-js")
(ok (buf= #?"[p]aram\noption\n")))))

(deftest vi-replace-char
(with-fake-interface ()
Expand Down

0 comments on commit 19469d5

Please sign in to comment.