Rewrap icon indicating copy to clipboard operation
Rewrap copied to clipboard

Request: always wrap when asked explicitly

Open vphantom opened this issue 6 years ago • 6 comments

Hello,

Thank you for Rewrap, a crucial feature somehow missing from vscode. That said, when dealing with Perl POD, I cannot convince Rewrap to do anything with plain text paragraphs. I tried selecting a paragraph and the usual ALT-Q, but I have to reflow my documentation manually, which is painful.

What technically prevents Rewrap from obeying when I highlight some text I want rewrapped?

Below is a Perl POD example, although my question is actually not language-specific: I think that ALT-Q should always rewrap what's highlighted (or the current paragraph) even if it is of an unrecognized format as seems to be the case here. Users can always CTRL-Z back if the result isn't satisfactory.

=head1 DESCRIPTION

=head2 Overview

This is a paragraph which Rewrap will refuse to touch even though it's essentially plain text.

=cut

use strict;
use warnings;

# This is a Perl comment which
# Rewrap will gladly handle.

vphantom avatar Aug 03 '18 15:08 vphantom

I had this same question and found this issue. A workaround I've found is to comment my selection (ctrl+/), wrap it (alt+q), then uncomment (ctrl+/). :man_shrugging:

dhagrow avatar Jun 03 '19 16:06 dhagrow

I think this is a really crucial feature, and the lack of it is making me look for other plugins. I often run into certain syntax which this plug-in won't let me wrap, such as Python doc strings. I think this should be an easy tweak for any reader familiar with extension programming?

tmewett avatar Jun 03 '20 11:06 tmewett

This is actually how the extension worked to begin with, but I had to change it. I don't remember off the top of my head why exactly, but I will look it up

stkb avatar Jun 03 '20 15:06 stkb

@stkb Have you had a chance to look into this? Can we be given the option to simply select a lump of text and use rewrap to wrap it rather than it being recognised as wrappable comment by Rewrap itself?

fy2 avatar Jun 19 '20 13:06 fy2

@fy2 Yeah, I don't have the all the details any more but basically it made the code much simpler not to have this.

However since this is a popular request I will add it back. I am working on something of a rewrite anyway and will add it into there.

As another workaround in the mean time you can also copy the text into a new buffer, and it will be wrapped as plain text in there, and then copy it back.

stkb avatar Jun 19 '20 17:06 stkb

As another work-around, you can change the file mode to plain text and then rewrap.

I ran into this with pod as well. Looking forward to seeing this when available.

bmartin avatar Feb 17 '23 13:02 bmartin