Skip to content
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

Text alignment #759

Closed
bluemix opened this issue Jan 16, 2018 · 10 comments

Comments

@bluemix
Copy link

commented Jan 16, 2018

Hello dears,
will it supports align right?

and thank you for this cool editor.

@bluemix bluemix changed the title Align right Text alignment Jan 16, 2018

@1024jp 1024jp self-assigned this Jan 16, 2018

@1024jp 1024jp added the request label Jan 16, 2018

@1024jp 1024jp added this to the 3.3.0 milestone Jan 16, 2018

@1024jp

This comment has been minimized.

Copy link
Member

commented Jan 17, 2018

Like this?

screen shot 2018-01-17 at 7 56 52 pm

I've just quickly implemented the option changing the text alignment.

However, since I don't speak any RTL languages, I'm not sure whether this is correct and fulfill your guys needs.

My current question is:
Which option is better for RTL languages: text alignment (the current implementation) vs. writing direction?
(You can see the difference between them in TextEdit.app's Format > Text.)

I'll release a beta version of the next CotEditor 3.3.0, which support this feature, at the end of January or begin of the February. So, please review it and give me feedback.

@bluemix

This comment has been minimized.

Copy link
Author

commented Jan 17, 2018

Actually, and in order to avoid confusion, in the Format menu, Text item should now have three options: Direction -> Left-to-right (LTR) | Right-to-left (RTL) options; as well as Alignment => Left | Center | Right, as well as Orientation -> Vertical | Horizontal

Which option is better for RTL languages: text alignment (the current implementation) vs. writing direction?

Both. The alignment and writing direction can be chosen from the menu according to the user needs of the selected lines or paragraphs. Sometimes I write mixed RTL and LTR texts, and if VS Code or Sublime supports alignment, neither supports RTL direction. As far as I know, if this feature implemented, this will be the first (after the TextEdit) GUI-based editor that truly supports RTL languages on macOS.

@1024jp

This comment has been minimized.

Copy link
Member

commented Jan 18, 2018

Thank you for answering my question. I understood the situation of the RTL writing.

Alignment => Left | Center | Right

IMO, the centring alignment is less important than other light or left ones. So, I'll definitely not implement it because it's also practically hard for a code editor. For example, to calculating indent positions or drawing a page guide.

The alignment and writing direction can be chosen from the menu according to the user needs of the selected lines or paragraphs.

Applying a style information, such as alignment, to a part of a document exceeds a function of a plain-text editor. A plain-text editor should handle documents as a plain-text even while editing on it. Therefore, CotEditor should only apply the alignment (or writing direction) option to the entire document.

Honestly speaking, I’m going only to implement either the alignment or the writing-direction. Sorry for such limitations.
So then, if CotEdtior needs to choose only one from them, which do you prefer?
Observing the TextEdit.app's implementation, TextEdit offers only the writing-direction option when the document is a plain-text. From this point of view, the writing-direction seems more important than alignment. Is it correct?


Considerable compromise: CotEditor may be able to implement applying writing-direction partly just like TextEdit.app does in the plain-text mode. That is, the direction of specific lines (namely, not "selection" one in TextEdit but "paragraph" one) becomes RTL only while editing in CotEditor, and such information is removed when the document is saved to a file, duplicated, or restored from a modification by another process. So, if you reopen the file next time, all text is aligned to a single side. However, I feel this implementation is kind of insufficient and, therefore, should be avoided.

@bluemix

This comment has been minimized.

Copy link
Author

commented Jan 18, 2018

Ok, I completely agree with your arguments.

So then, if CotEdtior needs to choose only one from them, which do you prefer?

Writing direction, as you said, because, it is more important and necessary than text alignment.
Thank you for your explanation and the work on this project :)

@1024jp

This comment has been minimized.

Copy link
Member

commented Jan 20, 2018

Thank you for the advice.
This feature will be added to CotEditor 3.3.0, which will be released (probably) in this February.

@1024jp

This comment has been minimized.

Copy link
Member

commented Jan 24, 2018

Today, I released a beta version for CotEditor 3.3.0 at coteditor.com/beta.
It would be helpful if you try it and give me feedback about the RTL whether it works correctly.

@bluemix

This comment has been minimized.

Copy link
Author

commented Jan 24, 2018

@1024jp i tested it against some of my Arabic articles, and it worked perfectly for me.

TextEdit was having a problem when setting the RTL, where it changes characters to the equivalent one of the language. For example, it was using a different character code for the hash (#) that it is used in the normal English, and caused problem when rendering the markdown content.
This issue didn't occur in CotEditor.

There is some suggestion, regarding the RTL, is that, I think, it would be good if line numbers of the editor would be on the right side when text is from right-to-left.
screen shot 2018-01-24 at 09 22 22

And, thank you very much 💯

@bluemix

This comment has been minimized.

Copy link
Author

commented Jan 24, 2018

Another thing I found today, is that, Syntax Style always shows None for any file I open.

screen shot 2018-01-24 at 11 47 03

1024jp added a commit that referenced this issue Jan 24, 2018

1024jp added a commit that referenced this issue Jan 24, 2018

@1024jp

This comment has been minimized.

Copy link
Member

commented Jan 24, 2018

Thank you for testing. I'm glad to hear that it works pretty well.

There is some suggestion, regarding the RTL, is that, I think, it would be good if line numbers of the editor would be on the right side when text is from right-to-left.

I agree with you. Actually, I already tried to implement it (as well as putting the vertical scroller to the opposite side); however, I found it is much much harder than I thought.
I keep looking for another way, but, I'm not sure if there is another easier way.

Apropos, I'm brushing up the RTL behaviors in CotEditor 3.0.0-beta.2 including adding a toolbar icon for writing direction toggle. I'll release this second beta soon.

Another thing I found today, is that, Syntax Style always shows None for any file I open.

It seems as if CotEditor failed to read bundled syntax styles for some reason.
Try simply restarting your Mac.
In addition, when it occurs only on CotEditor 3.3.0-beta, download .dmg again, place it somewhere on your computer, then launch CotEditor again.
If the issue still isn't resolved, then please create another issue.

@bluemix

This comment has been minimized.

Copy link
Author

commented Jan 25, 2018

In addition, when it occurs only on CotEditor 3.3.0-beta, download .dmg again, place it somewhere on your computer, then launch CotEditor again.
If the issue still isn't resolved, then please create another issue.

I restarted my Mac and downloaded it again, and still shows None Syntax Style.
OK, I'll open an issue about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.