Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: correctly remove indentation one line even if escaped line brake #144

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

guibou
Copy link
Owner

@guibou guibou commented Jan 3, 2025

Close #141.

[fmtTrim|
   foo\
   bar
|]

should be foobar instead of foo bar.

This is fixed by doing the whitespace trimming on the input string of
the quasiquotes (here \n foo\ bar) instead of the output string.

However it breaks two previous features:

  • When an interpolation block had whitespace, it should now be indented at least as much as the string, otherwise the interpolation block indentation will be used as reference.
  • Escaping the first line is now ignored. But actually, escaping the first line behaves exactly as not escaping the first line, so it breaks nothing.

Close #141.

```
[fmtTrim|
   foo\
   bar
|]
```

should be `foobar` instead of `foo   bar`.

This is fixed by doing the whitespace trimming on the input string of
the quasiquotes (here `\n    foo\    bar`) instead of the output string.

However it breaks two previous features:

- When an interpolation block had whitespace, it should now be
  indented at least as much as the string, otherwise the interpolation
  block indentation will be used as reference.
- Escaping the first line is now ignored. But actually, escaping the
  first line behaves exactly as not escaping the first line, so it
  breaks nothing.
@guibou guibou merged commit d0fed60 into main Jan 3, 2025
6 checks passed
@guibou guibou deleted the fix_wrapping_141 branch January 3, 2025 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No line break character breaks fmtTrim
1 participant