Giter VIP home page Giter VIP logo

Comments (5)

stkb avatar stkb commented on August 26, 2024 1

Closing as I think this is now fixed (since 1.2.0) but let me know if you're still having issues!

from rewrap.

stkb avatar stkb commented on August 26, 2024

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.

* Non elit aliqua ullamco nostrud. Excepteur officia do et officia sunt non voluptate mollit adipisicing dolore ex.

Wraps to:

* Non elit aliqua ullamco nostrud. Excepteur officia do et officia sunt
  non voluptate mollit adipisicing dolore ex.

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:

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
      sed do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat cupidatat non

Wraps to: 

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
      sed do eiusmod tempor incididunt ut labore et dolore
      magna aliqua excepteur sint occaecat cupidatat non
      proident, sunt in culpa qui officia deserunt mollit anim id
      est laborum.

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:

    * Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
      do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum, duis aute irure dolor in reprehenderit
    in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

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.

from rewrap.

stkb avatar stkb commented on August 26, 2024

I've just published v1.1.0, which contains the changes for LaTeX described above. Hopefully it should help.

from rewrap.

mschwerhoff avatar mschwerhoff commented on August 26, 2024

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 (.txt).

Regarding Markdown: wrapping indeed works as expected, also with messy lines.

Regarding LaTeX (using plugin version 1.1.0 and file extension .tex): the non-messy case works, e.g.

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
      sed do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat cupidatat non
      proident, sunt in culpa qui officia deserunt mollit anim id est laborum, duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
      Lorem ipsum dolor sit amet, consectetur adipiscing elit.

is wrapped to

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
      sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
      excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
      deserunt mollit anim id est laborum, duis aute irure dolor in
      reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
      pariatur. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

The messy case, however, doesn't wrap as expected. E.g.

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
      sed do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum, duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
      Lorem ipsum dolor sit amet, consectetur adipiscing elit.

wraps to

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
      sed do eiusmod tempor incididunt ut labore et dolore magna aliqua
      excepteur sint occaecat cupidatat non
    proident, sunt in culpa qui officia deserunt mollit anim id est laborum,
    duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
    eu fugiat nulla pariatur.
      Lorem ipsum dolor sit amet, consectetur adipiscing elit.

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.

from rewrap.

stkb avatar stkb commented on August 26, 2024

Have just published v1.2.0 which contains some more improvements for LaTeX. The messy case will now work here.

tex

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:

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
      sed do eiusmod tempor incididunt ut labore et dolore magna aliqua excepteur sint occaecat

Wraps to:

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
      sed do eiusmod tempor incididunt ut labore et dolore 
      magna aliqua excepteur sint occaecat

But

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt

Wraps to

\item Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt

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.

from rewrap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.