astrale-sharp / typstfmt

Apache License 2.0
253 stars 25 forks source link

[bug] newline sometimes appear after enum or list or term #83

Closed astrale-sharp closed 1 year ago

astrale-sharp commented 1 year ago
content before
+ Ligature: A merged glyph.
+ Kerning: A spacing adjustment
  between two adjacent
content after

becomes

content before
+ Ligature: A merged glyph.
+ Kerning: A spacing adjustment
  between two adjacent

content after

because content thinks it might need to break for not going over max_line_length

@Andrew15-5

astrale-sharp commented 1 year ago

The reason for the bug is that in rust "some text\n".lines().last() == Some("some text") instead of "" like I thought :grimacing:

astrale-sharp commented 1 year ago

Fixed by using .split("\n").last instead which is... a bit infuriating.

Andrew15-5 commented 1 year ago

You haven't updated commit hash in the newer version. I wanted to say that in new version it got fixed, but it's the same version with the same hash. The actual commit hash is different, though.

astrale-sharp commented 1 year ago

You haven't updated commit hash in the newer version. I wanted to say that in new version it got fixed, but it's the same version with the same hash. The actual commit hash is different, though.

I'm not following

astrale-sharp commented 1 year ago

Maybe something weird happened cause I just forcepushed? i forgot to squash a nitpick

Andrew15-5 commented 1 year ago

This commit https://github.com/astrale-sharp/typstfmt/commit/9da3fa3fe2208532877ee4d6a906373d6b37fade and this commit https://github.com/astrale-sharp/typstfmt/commit/56fbba68fdee349691cd52b3a90afe25221588a6 have the same hash from the https://github.com/astrale-sharp/typstfmt/commit/1817538516f56bd82d89a1d560bae633beb01e48. This is a big problem right now, when you are constantly pushing new commits. The typstfmt -v should always show the latest hash. You just forgot about it, probably. In the heat of passion.

meme ![meme](https://github.com/astrale-sharp/typstfmt/assets/37143421/a8f675fe-400f-41c2-8772-b22414ca0b3e)
astrale-sharp commented 1 year ago

Oh it's mostly that I only update it when releasing, which is also stupid :rofl:

astrale-sharp commented 1 year ago

I didn't yet find (look for) a good crate that does this programmatically, would be a good first issue too

astrale-sharp commented 1 year ago

I pushed a fix XD, hope it works it's hacky

Andrew15-5 commented 1 year ago

I, too, think it is a hack, but it's a working one!