-
Notifications
You must be signed in to change notification settings - Fork 26
Adds support for multiple wrap guide lines. #56
Adds support for multiple wrap guide lines. #56
Conversation
WIP because I have yet to add new spec tests to test multiple wrap guides specifically. |
3d043d8
to
f60c5b4
Compare
I would also love to get some feedback on the best way to resolve the potential weirdnesses listed above. The way I resolved it in
Potential weirdness in this situation would be if the user has a |
If we're going to make the right-most guide equivalent to This also means that |
f60c5b4
to
4cf77e2
Compare
Ok, I've added a number of spec tests to verify the multiple wrap guide feature. Commit message updated: Soft wrap is still governed by PR is no longer a work-in-progress :) |
cc5efd4
to
2b8e702
Compare
@50Wliu no longer work-in-progress :) |
2b8e702
to
feee7a9
Compare
Been using this for a few weeks now and haven't found any issues. |
3fcd284
to
cc2a859
Compare
PR updated following the recent merge of #65. |
Thanks @lexicalunit, and sorry for the delay in reviewing. I'll try to get someone to review it soon. |
Any update on this? Could someone merge that or tell me how to use it myself? |
cc2a859
to
3d057f0
Compare
@piranna you can currently get multiple wrap guides a number of ways:
$ git clone [email protected]:atom/wrap-guide.git
$ cd wrap-guide
$ git pull [email protected]:lexicalunit/wrap-guide.git lexicalunit/mulit-wrap-guide
$ npm install
$ apm link Of course you'll need to have set up
|
Forked on this one, and with horizontal rules too, you rocks! :-D |
3d057f0
to
cee646b
Compare
Welp. I rebased on the latest from
But now the expectation fails. I have no idea why. Seems like it should work just fine. Oh well. I'm going to continue to maintain the package |
Hrm. Weird. The spec tests passed on Travis CI. They fail completely for me using Atom 1.17beta on my local machine though. |
@50Wliu Sorry, I missed the message about adding the config schema. There wasn't previously a schema for I added a config schema for |
lib/wrap-guide-element.coffee
Outdated
|
||
updateGuidesCallback = (args) => | ||
# ensure that multiple guides stay sorted in ascending order | ||
guides = uniq(args.newValue) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid bringing in a new dependency, how about the following instead?
guides = args.newValue.filter((item, index) -> args.newValue.indexOf(item) is index)
It's unclear to me if uniq
sorts the array. Nevertheless, that can also be done easily: guides.sort((a, b) -> a - b)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, makes sense to me. I wasn't totally sure if we wanted to bring in the dependency or just roll our own solution here. PR updated. I also made the function use more clear by naming it uniqueAscending()
.
4967bf7
to
e4fa639
Compare
@lexicalunit is there ever a use case where you might want a guide that's past the |
@50Wliu I have a similar setup to the one you linked to. For me it's the following:
As far as I know, the only thing So in my setup, soft wrap doesn't kick in until we get to the final guide. The other guides are there for me to know when I need to insert newlines if, for example, I'm writing a git commit message in Atom. Note that I also have it so when I right click on a wrap guide I can pick "Line Break at this Guide" and have the So no, I haven't found a reason to have soft wrap kick in before the last guide except for the case where the edge of the Atom window comes before the wrap guide. I don't think @amazingant is talking about having I'm trying to imagine why someone might want to do it though. If they did, the guides past the preferred line length would be of no use since no text would ever be able to reach them. |
@lexicalunit: Yes, my guides are for the same mental reminder of "you should probably add a line break here for content type X". The only place where I have a hard wrap before the guide is in my vim config when I'm editing a git commit message. I have a guide line in vim at 80, but the first line only of the commit message hard wraps at 72. I wouldn't immediately think to use atom's |
e4fa639
to
f7b9f03
Compare
@50Wliu: I just rebased on master to resolve conflicts. Since |
@lexicalunit @amazingant thanks for the explanations :). I will discuss with the team about whether it's safe or not to replace the removed columns setting with this one. |
f7b9f03
to
90ffcf5
Compare
I'm 👍 on using Ping me when you're ready and I'll be happy to merge and 🚢 😄 |
In that case, shall I update the PR to use |
Yes please 🙇 |
This patch creates guides at the columns listed in `wrap-guide.guides`. Unfortunately `wrap-guide.columns` is a deprecated setting and I want to avoid any potential conflicts. It also creates a distinction between element `.wrap-guide` and a new element, `.wrap-guide-container`. The container class now contains multiple child nodes of class `.wrap-guide`. Tests updated accordingly. Configuring guide styles will still work as indicated in `README.md`. Soft wrap is still governed by `editor.preferredLineLength`, which is language-specific. `wrap-guide.guides` is also language-specific and the right-most guide defines the preferred line length. Updates to one will change the other, and vice-versa. Closes atom#14.
90ffcf5
to
e44889d
Compare
Done, and rebased on |
Excellent, thanks! |
Does this one have horizontal rules? If so, multiple ones as I requested in the other repo? |
Sorry, this PR was just for vertical columns. |
Should I create a new one here, or is enough with the one in the other repo as reminder? :-) |
When will this feature ship? |
@JosephTLyons I'll be publishing an update to |
Amazing! I’ve been wanting this feature natively for so long! I didn’t care for the multi line package or hacking it, this will be a great addition! |
So this will be showing up in the Atom 1.36 then? |
Yes, it is currently scheduled to be released with v1.36. |
This patch creates guides at the columns listed in
wrap-guide.guides
.Unfortunately
wrap-guide.columns
is a deprecated setting and I want toavoid any potential conflicts.
It also creates a distinction between element
.wrap-guide
and a newelement,
.wrap-guide-container
. The container class now containsmultiple child nodes of class
.wrap-guide
. Tests updated accordingly.Configuring guide styles will still work as indicated in
README.md
.Potential weirdnesses:
wrap-guide.guides
setting is not language-specific.editor.preferredLineLength
, which islanguage-specific. This can differ with the setting for the right
most guide, causing dissonance.
Closes #14.