Inserting whitespace does not preserve point position
Thanks for this library! I've been using it for a bit and noticed a strange bug. Here's a minimal test case (assumes you have `shfmt` installed)
# Setup
Create a file `test.sh` and insert the following (delete the "|" character and place point there).
```sh
function main() {
a=|
return 0
}
```
then run `apheleia-format-buffer`.
FYI, the number of lines after point is significant. The bug shows up only if there are 2 or more lines after point in the buffer. Point moves as expected if the test case only has one line after it.
# Expected
```sh
function main() {
a=|
return 0
}
```
# Actual
```sh
function main() {
| a=
return 0
}
```
关闭于 2025-05-19 2 条评论