[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#68781: [PATCH] Don't fill yaml except comments and block scalars.
From: |
Randy Taylor |
Subject: |
bug#68781: [PATCH] Don't fill yaml except comments and block scalars. |
Date: |
Mon, 29 Jan 2024 03:47:53 +0000 |
On Sunday, January 28th, 2024 at 08:15, Rudolf Schlatte <rudi@constantly.at>
wrote:
>
>
> Tags: patch
>
> Hi,
>
> Currently, yaml-ts-mode fills comments and block scalars (multi-line
> text literals) as expected, but re-fills the whole file when point is
> outside of either of these constructs. Since yaml line breaks and
> whitespace are significant, I'd say that this is never the correct
> behavior.
>
> This patch against current master inhibits M-q (fill-paragraph) outside
> of comments and block scalars. In my tests default fill-paragraph
> worked as expected both with and without justify, correctly detecting
> comment and block literal boundaries, so I did not preserve the previous
> code in `yaml-ts-mode--fill-paragraph'.
Thanks for working on this.
The previous implementation (see bug#68226) provided an example where:
foo: |
line-one
line-two
Would become:
foo: | line-one line-two
When it should be:
foo: |
line-one line-two
Your patch undoes this fix.
I think I also ran into another bug using your patch: when inside a block
scalar, for example, running fill-paragraph will re-fill the whole file (or
parts of it at least).
I agree that we shouldn't try to fill anything that isn't a comment or block
scalar, and I also like the change in your other message where only the
paragraph that point is on gets filled.
BTW would it be possible to add tests for these? See `c-ts-mode-tests.el',
specifically `c-ts-mode-test-filling', for inspiration.
Graham, you added `yaml-ts-mode--fill-paragraph' - what are your thoughts? See
also Rudolf's other message.