From eab4cac12fc0eedc67c5393d98d90f2a20ebb63e Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 3 Sep 2020 06:23:30 +0200 Subject: [PATCH] Regenerate line break hints after newline Fixes #486. --- src/dfmt/formatter.d | 2 +- tests/allman/issue0486.d.ref | 5 +++++ tests/issue0486.args | 1 + tests/issue0486.d | 5 +++++ tests/otbs/issue0486.d.ref | 4 ++++ 5 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/allman/issue0486.d.ref create mode 100644 tests/issue0486.args create mode 100644 tests/issue0486.d create mode 100644 tests/otbs/issue0486.d.ref diff --git a/src/dfmt/formatter.d b/src/dfmt/formatter.d index 16eb6ed..2d03b54 100644 --- a/src/dfmt/formatter.d +++ b/src/dfmt/formatter.d @@ -1406,7 +1406,7 @@ private: { pushWrapIndent(); newline(); - if (ufcsWrap) + if (ufcsWrap || onNextLine) regenLineBreakHints(index); } writeToken(); diff --git a/tests/allman/issue0486.d.ref b/tests/allman/issue0486.d.ref new file mode 100644 index 0000000..de7a540 --- /dev/null +++ b/tests/allman/issue0486.d.ref @@ -0,0 +1,5 @@ +void main() +{ + auto someAutoVariableName = this.firstLink.secondLink + .filter!(shouldBeProbablySomeIdentifierOrNot); +} diff --git a/tests/issue0486.args b/tests/issue0486.args new file mode 100644 index 0000000..7e7e52d --- /dev/null +++ b/tests/issue0486.args @@ -0,0 +1 @@ +--keep_line_breaks=true diff --git a/tests/issue0486.d b/tests/issue0486.d new file mode 100644 index 0000000..de7a540 --- /dev/null +++ b/tests/issue0486.d @@ -0,0 +1,5 @@ +void main() +{ + auto someAutoVariableName = this.firstLink.secondLink + .filter!(shouldBeProbablySomeIdentifierOrNot); +} diff --git a/tests/otbs/issue0486.d.ref b/tests/otbs/issue0486.d.ref new file mode 100644 index 0000000..5f65301 --- /dev/null +++ b/tests/otbs/issue0486.d.ref @@ -0,0 +1,4 @@ +void main() { + auto someAutoVariableName = this.firstLink.secondLink + .filter!(shouldBeProbablySomeIdentifierOrNot); +}