Skip to content

Commit

Permalink
Fix tail insertion
Browse files Browse the repository at this point in the history
  • Loading branch information
grierson committed Aug 18, 2023
1 parent a6596e4 commit 7dab75f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion fnl/formedit/insertion.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[end-row end-col] [(form:end_)]
end-col (- end-col 1)]
(vim.api.nvim_buf_set_text 0 end-row end-col end-row end-col [" "])
(vim.api.nvim_win_set_cursor 0 [(+ end-row 1) end-row])
(vim.api.nvim_win_set_cursor 0 [(+ end-row 1) (+ end-col 1)])
(vim.api.nvim_feedkeys :i :n true)))

{: head : tail}
8 changes: 3 additions & 5 deletions fnl/spec/insertion_spec.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(local insertion (require :formedit.insertion))

(local head-keymap :<localleader>h)
(local tail-keymap :<localleader>t)
(local tail-keymap :<localleader>H)

(describe "head insertion"
(fn []
Expand Down Expand Up @@ -35,11 +35,9 @@
(fn []
(h.setup {:content "(1)" :cursor [1 0]})
(h.feedkeys tail-keymap)
(h.expect {:content "(1 )" :cursor [1 3]})))
(h.expect {:content "(1 )" :cursor [1 2]})))
(it :sub
(fn []
(h.setup {:content "(1 (2))" :cursor [1 3]})
(h.feedkeys tail-keymap)
(h.expect {:content "(1 (2 ))" :cursor [1 6]})))))

(print "foo")
(h.expect {:content "(1 (2 ))" :cursor [1 5]})))))
2 changes: 1 addition & 1 deletion lua/formedit/insertion.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions lua/spec/insertion_spec.lua

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7dab75f

Please sign in to comment.