+2
“Wrap paragraph at X characters”—weird behaviour
While editing XML I've noticed that wrapping text (a paragraph) inside any kind of tag is done erroneously.
I've create a pastebin to demonstrate the behaviour; it has four chunk of text:
- Line 1: a single line of non-wrapped text
- Line 3: the previous line wrapped with Alt+Q (working as intended)
- Line 10: the same text that is on the first line, but between the tag tag
- Line 12: the above text within the tags after pressing Alt+Q (notice the opening angled brackets)
I think this isn't supposed to work like this.
I've managed to track down which Python module does the wrapping (paragraph.py).
In the class WrapLinesCommand there is the line
line_prefix_pattern = re.compile("^\W+")
that if changed to
line_prefix_pattern = re.compile("^")
the problem (my problem at least) is solved.
Partially, because I've also noticed that the module doesn't try to wrap the selected text, but a paragraph instead. If I have tags nested into each other (say, 3 levels deep) and I select the text on the third level (which could possibly contain in-line tags) then everything gets wrapped up to the first level.
Is there a way to make wrapping work on selections rather than paragraphs?
I've used a vanilla 2165 build for the test, but I've checked that it worked like this since 2139 or so.
By the way, I couldn't measure the further implications of this change, so maybe it is plain rubbish.
Kundesupport af UserEcho
It is a feature not a bug :D
The prefix means this function will take a prefix to your paragraph (like, all the preceding whitespace), and repeat that prefix on subsequent lines.
So:
- If you try to wrap a paragraph within a comment section in a source file, the comment character will get repeated on every line, just as it should.
- If you try to wrap indented paragraph, it will stay indented.
However, I would really like the wrapping function to detect I have selected something and then wrap only selection…