Skip to content

Commit

Permalink
Minor bug fixes (#77)
Browse files Browse the repository at this point in the history
* Better handle multibyte char insert

* Display buffer name when trying to autoformat
  • Loading branch information
justinbarclay authored Mar 28, 2024
1 parent e197bbd commit d565d51
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
7 changes: 4 additions & 3 deletions parinfer-rust-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,12 @@ against and is known to be api compatible.")
(yank . "paren")
(counsel-yank-pop . "paren")
(evil-open-above . "paren")
(evil-change-whole-line . "paren"))
(evil-change-whole-line . "paren")
(quoted-insert . "paren")
"Commands to run with certain Parinfer mode.
A curated list of pairs consisting of a command and the mode the
command should be run in.")
command should be run in."))

;;;;;;;;;;;;;;;;;;;;;;;;;
;; Local State
Expand Down Expand Up @@ -453,7 +454,7 @@ If a change is detected in the buffer, prompt the user to see if they still want
`parinfer-rust-mode' enabled."
(when (parinfer-rust--execute-change-buffer-p "paren")
(if (y-or-n-p
"Parinfer needs to modify indentation in this buffer to work. Continue? ")
(format "Parinfer needs to modify indentation in the buffer %s to work. Continue? " (current-buffer)))
(let ((parinfer-rust--mode "paren"))
(parinfer-rust--execute))
t)))
Expand Down
15 changes: 15 additions & 0 deletions test/user-submitted-cases.el
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,18 @@
(with-temp-buffer
(insert buffer-state)
(parinfer-rust--check-for-indentation)))))

(ert-deftest doesnt-handles-utf-8 ()
(let ((test
'(:before
"(func 中)"
:after
"(func 中 )"
:commands (((:lineNo 0 :column 8) (lambda () (insert " ")))))))
(should-not
(string=
(simulate-parinfer-in-another-buffer--with-commands (plist-get test :before)
"smart"
(plist-get test :commands)
(plist-get test :setup))
(plist-get test :after)))))

0 comments on commit d565d51

Please sign in to comment.