Skip to content

Commit

Permalink
Fix cursor placement for wrap
Browse files Browse the repository at this point in the history
  • Loading branch information
grierson committed Aug 15, 2023
1 parent 0656b52 commit 6774ec0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion fnl/formedit/wrap.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(vim.api.nvim_buf_set_text 0 end-row end-col end-row end-col [")"])
(vim.api.nvim_buf_set_text 0 start-row start-col start-row start-col ["( "])
(vim.api.nvim_win_set_cursor 0
[(+ start-row 1) (+ start-col insert-offset)])
[(+ start-row 1) (+ start-col insert-offset 1)])
(vim.api.nvim_feedkeys :i :n true)))

{: head}
7 changes: 3 additions & 4 deletions fnl/spec/wrap_spec.fnl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@
(fn []
(h.setup {:content "(1)" :cursor [1 0]})
(h.feedkeys keymap)
(h.expect {:content "( (1))" :cursor [1 0]})))
(h.expect {:content "( (1))" :cursor [1 1]})))
(it "sub form"
(fn []
(h.setup {:content "(1 (2))" :cursor [1 4]})
(h.setup {:content "(1 (2))" :cursor [1 3]})
(h.feedkeys keymap)
(h.expect {:content "(1 ( (2)))" :cursor [1 3]})))))
(h.expect {:content "(1 ( (2)))" :cursor [1 4]})))))

(print :foo)
2 changes: 1 addition & 1 deletion lua/formedit/wrap.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/wrap_spec.lua

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

0 comments on commit 6774ec0

Please sign in to comment.