-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preserve indentation of the first line to wrap #23
Comments
Ok a few things going on here. Firstly just taking Markdown for a moment, if there's something that's specifically not working there could you give me an example? For example, bullet points should already be working as you describe.
Wraps to:
I'm not sure if you're also using them in LaTeX, or another language. Rewrap also already preserves the indentation of the second line elsewhere (eg multiline comments). So it wouldn't be out of the question to implement it in other places too. Back to LaTeX: support is something that's been on the radar, but I've just been waiting for someone to request it. However, the extension currently doesn't recognise the language at all, which means it defaults to the Markdown processor, which won't always produce good results for LaTeX. I've now made a quick change in master, so that it recognises it as a source code file (with % for comments). This will immediately change some behaviour and give some improvements. Eg this example will now work:
As long as the cursor is on the second line (or the whole thing is selected). This comes because the starting text is now already seen as 2 separate paragraphs, because of the difference in indentation. The last example, with very messy lines:
Again, this should already work in Markdown, so if you're using it somewhere else, maybe we can have it work automatically there too. I'd like to try that before creating extra behaviours depending on what is selected. |
I've just published v1.1.0, which contains the changes for LaTeX described above. Hopefully it should help. |
Thanks for the quick reactions and sorry for the delay from my side. I also think that there was some confusion on my site: I wasn't aware that the wrapping is filetype-dependent (which makes perfect sense), and if I remember correctly, I tried the examples with a plain old text file ( Regarding Markdown: wrapping indeed works as expected, also with messy lines. Regarding LaTeX (using plugin version 1.1.0 and file extension
is wrapped to
The messy case, however, doesn't wrap as expected. E.g.
wraps to
I tried selecting only the second and subsequent lines (and the other way round, to have the cursor on the second line) and also the whole block (including the first line), but the behaviour is always the same. |
Have just published v1.2.0 which contains some more improvements for LaTeX. The messy case will now work here. It's also now detected as a single paragraph so you only have to have your cursor in the paragraph to wrap the whole thing. The indent of the 2nd+ lines is determined by the indent of the 2nd line. However if there's only 1 line to begin with, then following lines will have the same indent as that one. Eg:
Wraps to:
But
Wraps to
I've wondered in the past about adding a "default indent" setting for this case, so if you'd find it very helpful I could add that too. |
Closing as I think this is now fixed (since 1.2.0) but let me know if you're still having issues! |
It would be handy, e.g. when working with LaTeX, Markdown or mark-up languages in general, if wrapping preserved the indentation of the first line. Ideally, lines such as
would be magically wrapped to
However, since this is probably difficult to achieve in general, it would already be great if the indentation of the first selected line were preserved when wrapping. E.g. selecting and wrapping the second line of the block
would preserve the manually created indentation and yield
This should also work if multiple lines are selected: e.g. selecting and wrapping the second and all subsequent lines of the block
should yield
The text was updated successfully, but these errors were encountered: