Closed roachsinai closed 5 years ago
QML's trim function follow's the ECMA standard and removes all whitespace
http://www.ecma-international.org/ecma-262/9.0/index.html#prod-WhiteSpace WhiteSpace::
<TAB> <VT> <FF> <SP> <NBSP> <ZWNBSP> <USP>
Other category “Zs” | Any other Unicode “Space_Separator” code point | <USP>
https://en.wikipedia.org/wiki/Whitespace_character
U+2003 | em space | 8195
| ... | Also known as "mutton". Width of one em. U+2001 Em Quad is canonically equivalent to this character; U+2003 is preferred. HTML/XML named entity: 
Are you asking for a checkbox to disable the trimming? What you're after could probably be done with a "spacer" (there should be an "Add Spacer" button when editing the panel).
You should be able to just remove the .trim()
call. You'll probably have a space where the final newline (\n
) is, so replace the newline with an empty string instead.
// widget.outputText = stdout.replace('\n', ' ').trim()
// widget.outputText = stdout.replace('\n', ' ')
widget.outputText = stdout.replace('\n', '')
Thanks!
Is there a way to keep the ending em-spaces?
Now behavior:
cause echo get the em-space, does the reason is https://github.com/Zren/plasma-applet-commandoutput/blob/50f97fffc04e577b4e38cdb12cf9be204d7bbe24/package/contents/ui/main.qml#L64 ?
And behavior after add something in the begining and ending:
Expected behavior
trim spaces not em-spaces.