Skip to content

Commit

Permalink
Don't repeat movement command on "."
Browse files Browse the repository at this point in the history
Related to issue #108
  • Loading branch information
takikawa committed May 6, 2016
1 parent 4a8a065 commit ea9b12e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
16 changes: 15 additions & 1 deletion private/commands.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
(struct-out repeat-command)
(struct-out repeat-motion)
(struct-out replace-command)
(struct-out goto-command))
(struct-out goto-command)
movement-command?)

;; A Command is one of
;; - Symbol
Expand Down Expand Up @@ -261,3 +262,16 @@
[#\" 'double-quote]
[(or #\space #\l) 'right]
[_ #f]))

;; check if the given command is a movement command
(define (movement-command? command)
(or (goto-command? command)
(memq command
'(left down up right
next-page previous-page
next-word previous-word
continue
start-of-line end-of-line
start-of-line-content
match
start-of-file end-of-file))))
3 changes: 2 additions & 1 deletion private/text.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@
(scroll-to-position pos)]
[_ (handle-simple-command command)])

(unless (eq? command 'single-repeat)
(unless (or (eq? command 'single-repeat)
(movement-command? command))
(set! last-command command)))

;; handle a command with no motion/repeat
Expand Down
6 changes: 6 additions & 0 deletions tests/unit-tests.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,12 @@
'(#\d #\a #\w #\.)
@~a{})

;; Issue #108, "." on movement
(check-vim
@~a{foo bar}
'(#\x #\l #\.)
@~a{o bar})

;; Issue #88, "~"
(check-vim
@~a{fOo bar}
Expand Down

0 comments on commit ea9b12e

Please sign in to comment.