JosephTLyons / text-align

An Atom text editor package that supports left aligning, centering, right aligning, and justification of text between the left side of the editor and the Preferred Line Length setting.
MIT License
0 stars 1 forks source link

Is this package possible to implement real-time (vs selecting text and triggering manually)? #2

Open gammacray opened 4 years ago

gammacray commented 4 years ago

I've been trying to set my editor panes to justify with CSS or any other strategy I can find, and I'm starting to think that text-align: justify and text-justify aren't supported by Atom. Can I ask how you achieve justification with your package and whether or not you can set it to automatically reflow text with justification, real-time?

I'd like to set Atom up like most other word processors, in which this option is pretty standard.

Also I should note that I write with markdown, and your package doesn't seem to be enabled with .md files. It has no effect on my selected text when toggled (right, left, justify, etc).

Thanks.

JosephTLyons commented 4 years ago

Hello @gammacray,

I would love to have text-align be a real-time package, but I've struggled with implementing this before with other packages. I tried writing a package called autobreak that would automatically add newlines to words as they crossed over the wrap guide, but there are a lot of cases to consider for this (deleting text would require recalculating large chunks of text, inserting text in the middle of paragraphs would need to work differently than when you are writing text and your cursor is at the end of the chunk of text, etc); I was able to get outbreak to work correctly in some cases, but not in all cases. I found other packages where people tried to implement just some basic automatic text breaking as you typed, but those packages also didn't cover all the cases you'd expect out of a normal word processor, like Word. Since I've already explored automatic formatting in much simpler cases and failed, it would be hard to say I could implement it for text-align and its various ways of formatting text. I'd love to get some PRs if someone was interested in doing it.

Everything text-align does is after-the-fact, unfortunately. You have to type things up, then highlight the text, and run the commands. Again, I would love for it to be automatic, I have just been unsuccessful with this myself in the past.

You can certainly justify text with text-align. Here's a GIF with me using the command palette to run all the alignments on a paragraph (althoughI I usually just use the key commands myself):

justify paragraph

Also, to my knowledge, text-align does support md markdown files:

markdown test

If it is not working for you, could you attach a GIF or something for me to see? Maybe you are using another flavor of markdown than .md?

What OS are you running and what version of Atom do you have installed? If something is broken there, I'd like to fix it.

gammacray commented 3 years ago

Sorry it's taken me so long to reply. I appreciate your in-depth response to my questions. I still haven't found a workable solution for getting text justified in-editor, realtime. I don't think a lot of people use Atom for prose work, so some of these kinds of features are overlooked. I've found some fun hacky workarounds for a lot of things. Not this one though. For some reason Atom refuses to justify text. Even the CSS tags 'text-alignment: justify' and 'text-justify' do nothing in styles.less which is weird.

I regret to inform you that I've moved on from this concern for now. I will say that I couldn't get your package to have any effect on markdown files. I don't know what I was missing. It's moot anyhow, because by the time I've written a file in markdown I export it with pandoc-convert into .pdf or .docx and it's nicely justified in those output formats, which are what I send to clients. By way of saying, your package is an extra unnecessary step in my workflow because I always proof my work in the output files, before sending on.

I've just learned to live with unjustified text for the time being. I've brought it up in the Atom forums (regarding why the CSS doesn't work) but so far nobody has replied with a solution. I'm not a hacker, I'm a writer. So on I go, writing.

Thanks again.