Line-wrapping bug
See original GitHub issuePotentially related to #761
Expected Behavior
- Code is not line-wrapped, OR
- code is line-wrapped at 80 chars and preserves indentation, OR
- control over line-wrapping (best behavior)
Actual Behavior
Line with <= 80 chars gets wrapped to newline, ignoring indentation
(Compare lines 5 and 6 in the output below to the input snippet)
Details
Output:
Input:
function html (tagName, attributes, ...childNodes) {
const el = document.createElement(tagName);
if (attributes) {
for (const [prop, value] of Object.entries(attributes)) {
if (prop === 'style' && (Array.isArray(value) || value instanceof Map)) {
for (const declaration of value) {
el.style.setProperty(...declaration);
}
}
else {
el.setAttribute(prop, value);
}
}
}
if (childNodes) {
for (let node of childNodes) {
if (typeof node === 'string') {
node = document.createTextNode(node);
}
el.appendChild(node);
}
}
return el;
}
Carbon config:
(Note: I removed the icon
property)
{
"paddingVertical": "0px",
"paddingHorizontal": "0px",
"marginVertical": "45px",
"marginHorizontal": "45px",
"backgroundImage": null,
"backgroundImageSelection": null,
"backgroundMode": "color",
"backgroundColor": "rgba(171, 184, 195, 1)",
"dropShadow": false,
"dropShadowOffsetY": "20px",
"dropShadowBlurRadius": "68px",
"theme": "one-dark",
"windowTheme": "sharp",
"language": "javascript",
"fontFamily": "Hack",
"fontSize": "14px",
"lineHeight": "133%",
"windowControls": false,
"widthAdjustment": false,
"lineNumbers": true,
"exportSize": "2x",
"watermark": false,
"squaredImage": false,
"loading": false,
"isVisible": true,
"custom": true
}
Browser:
Win 10, Chrome 75.0.3770.80Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Line wrapping visual issue (eats itself from behind) #2713
-After wrapping around once, and eating itself up completely, the line correctly hits the right edge of the window and wraps around, changing ......
Read more >[Bug] Microsoft Word Wrapping & Paragraph
Mainly problems is that the image wraps and the paragraph is often messed up when i opening my assignment from Microsoft Word Mobile....
Read more >Fixing My Line Wrap Issue in iTerm 2 - Tim Dunklee
The problem was that when text was supposed to wrap to a new line (e.g. writing a long commit message) it would instead...
Read more >[KNOWN BUG] Text wrapping not working in lines (Has ...
Description: When adding text to lines, the text wrapping does not function properly. It goes over the edge and extends past where the...
Read more >textwrap — Text wrapping and filling — Python 3.11.1 ...
Wraps the single paragraph in text (a string) so every line is at most width characters long. Returns a list of output lines,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Noticing an incorrect linewrap of my own on Chrome 77.0.3865.90 (linux) with:
Seems like there should be a linebreak before the
_ => panic!("Unexpected values"),
instead of just following on as a continuation.I have no idea at this time what the cause of the issue is. If I had to guess I would say that some kind of width calculation is very slightly off, so it renders incorrect results when certain combinations of fonts, font sizes and rendering engines are used.