Róbert Kohányi 6 years ago • updated by Piotr Kalinowski 5 years ago 3
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.

I saw this odd behavior as well (version 2.0 build 2210) and your fix worked for me as well. The only difference was that I was editing plain HTML files and saw the same behavior. Thanks for the fix.
Still happening on 2.0.1.

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.


- 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…