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

Support editor rtl mode without wrapped lines #4665

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

adrianheine
Copy link
Contributor

This seems to work pretty well, even with changing fixedGutter and direction.

@marijnh
Copy link
Member

marijnh commented Mar 30, 2017

Nice. Some things jump out though (tested in Chrome):

  • When doing editor.setOption("direction", "rtl") on the main website (/index.html), selecting with the mouse seems to completely stop working -- so I guess finding the position at coordinates broke.

  • Setting the direction back with editor.setOption("direction", "rtl") leaves an empty gap to the left of the code.

@adrianheine
Copy link
Contributor Author

Both should be fixed now.

@marijnh
Copy link
Member

marijnh commented Mar 31, 2017

A few more:

When you have a long line in an rtl editor (which also has a vertical scrollbar), the left end of the line ends up below the scrollbar.

Also, anything beyond the first screen width, horizontally, doesn't get selection drawn (the selection rectangles stop at the original width) and doesn't properly handle mouse clicks (they are treated as if they are inside the original width)

@marijnh
Copy link
Member

marijnh commented Mar 31, 2017

(This kind of stuff is why my first impulse was to forget about putting the scrollbar on the left, but I applaud your effort to do things right.)

@adrianheine adrianheine force-pushed the rtlMode branch 2 times, most recently from 0b366e5 to 0844945 Compare April 20, 2017 13:59
@adrianheine
Copy link
Contributor Author

When you have a long line in an rtl editor (which also has a vertical scrollbar), the left end of the line ends up below the scrollbar.

Chromium?

Also, anything beyond the first screen width, horizontally, doesn't get selection drawn (the selection rectangles stop at the original width) and doesn't properly handle mouse clicks (they are treated as if they are inside the original width)

Should be better now.

@marijnh
Copy link
Member

marijnh commented Apr 20, 2017

Yes, the content under the scrollbar happens in Chrome (57).

Should be better now.

Great!

Also, in the editor on index.html (which auto-resizes up to a certain point), when you type a long line the horizontal scrollbar initially doesn't appear, both in Firefox and Chrome. Note that many parts of the scrolling code are written the way they are because they need to handle both the auto-resize-through-CSS and the scrollbar model, and you'll have to test both when you touch it. That stuff could use more automated tests I guess, especially since different browsers behave slightly differently with, for example, how they handle the way a margin on an absolutely positioned element influences the parent container's size.

Then I got this error a few times when clicking around in an RTL editor:

Error: Broke out of infinite loop in coordsCharInner  codemirror.js:2838:49

And clicking on the rightmost part of the document in RTL mode when there's a horizontal scrollbar (which is scrolled all the way to the right) often (but not always) causes the editor to scroll to the left, in Firefox and Chrome.

I saw the gutter in the wrong place a few times, directly after setting the direction option, or during scrolling. I can reliably reproduce this by opening mode/javascript/index.html in Chrome and running editor.setOption("direction", "rtl") in the console.

@adrianheine
Copy link
Contributor Author

adrianheine commented Apr 25, 2017

I saw the gutter in the wrong place a few times, directly after setting the direction option, or during scrolling. I can reliably reproduce this by opening mode/javascript/index.html in Chrome and running editor.setOption("direction", "rtl") in the console.

Fixed.

And clicking on the rightmost part of the document in RTL mode when there's a horizontal scrollbar (which is scrolled all the way to the right) often (but not always) causes the editor to scroll to the left, in Firefox and Chrome.

I think this should only happen in Chrome, not in Firefox. I used Epiphany for Webkit testing, which as I realized today handles scrollLeft in rtl content like Firefox, not like Chrome. Epiphany uses Webkit2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants