Commit eca495f
committed
bug #51378 [Console] avoid multiple new line when message already ends with a new line in section output (joelwurtz)
This PR was merged into the 6.3 branch.
Discussion
----------
[Console] avoid multiple new line when message already ends with a new line in section output
| Q | A
| ------------- | ---
| Branch? | 6.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | symfony/symfony#50382
| License | MIT
| Doc PR |
When we write to the section with a new line in the message it ends up adding a double new line, it can be easily seen when we set a section as a console handler for the logs, each line of log will have a double new line ending adding a lot of noise.
I began to fix the implementation to correctly handle this case, but with all the logic of the max height and other stuff it appears to be way more complicated.
Simulating this case by removing the new line at the end of the message and recalling the write function with the newline parameter to true was way easier and avoid too many headcache when looking at the code.
Should fix symfony/symfony#50382
Commits
-------
1f20f72640 fix(console): avoid multiple new line when message already ends with a new lineFile tree
3 files changed
+25
-8
lines changed- Output
- Tests
- Output
- Style
3 files changed
+25
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
122 | | - | |
123 | | - | |
| 122 | + | |
124 | 123 | | |
125 | 124 | | |
126 | 125 | | |
| |||
168 | 167 | | |
169 | 168 | | |
170 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
293 | 305 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
215 | | - | |
| 215 | + | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
220 | | - | |
| 219 | + | |
| 220 | + | |
221 | 221 | | |
222 | | - | |
223 | | - | |
| 222 | + | |
| 223 | + | |
224 | 224 | | |
225 | 225 | | |
226 | 226 | | |
0 commit comments