Work around 2^16 buffer char limit

This commit is contained in:
Radon Rosborough 2020-08-23 13:09:43 -06:00
parent 6aff83d5ac
commit c77a781912
2 changed files with 12 additions and 2 deletions

View file

@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog]. The format is based on [Keep a Changelog].
## Unreleased
### Bugs fixed
* Apheleia experiences difficulty formatting buffers longer than 2^16
characters. Previously, the formatting operation would fail entirely
in this case. Now it works, albeit with degraded performance.
## 1.1.1 (released 2020-07-16) ## 1.1.1 (released 2020-07-16)
### Formatters ### Formatters
* New: [OCamlFormat](https://github.com/ocaml-ppx/ocamlformat) for * New: [OCamlFormat](https://github.com/ocaml-ppx/ocamlformat) for

View file

@ -293,7 +293,7 @@ provided that its exit status is 0."
(if (funcall (if (funcall
(or exit-status (or exit-status
(lambda (status) (lambda (status)
(= 0 status))) (= 0 (logand 255 status))))
(process-exit-status proc)) (process-exit-status proc))
(when callback (when callback
(funcall callback stdout)) (funcall callback stdout))
@ -315,7 +315,11 @@ provided that its exit status is 0."
(with-current-buffer stdin (with-current-buffer stdin
(buffer-string)))) (buffer-string))))
(process-send-eof apheleia--current-process)) (process-send-eof apheleia--current-process))
(error (message "Failed to run %s: %s" name (error-message-string e)))))) (error
(unless (string-match-p
"process .+ no longer connected to pipe; closed it"
(error-message-string e))
(message "Failed to run %s: %s" name (error-message-string e)))))))
(defun apheleia--write-region-silently (defun apheleia--write-region-silently
(start end filename &optional (start end filename &optional