keymap-editor
keymap-editor copied to clipboard
Preserve whitespace for inline comments
When encountering lines in the devicetree such as
foo; // bar
this gets parsed into two nodes: property
, and comment
. Then two steps are followed:
- the preceding whitespace is removed (ignored, rather, because the comment node only starts at the
//
) - the contents of the comment node are added to the contents of its preceding sibling node
which means the output is
foo;// bar
In order to add the comment text to the same line it is already checking that both nodes are on the same line, so this same property can be used to see how much whitespace exists between the two nodes and copy it.