Mobileread
Suggestion: work in RTL mode
#1  isaacbh 02-27-2021, 10:38 AM
I mainly work with Hebrew text, and I wish there was a way of adjusting Sigil for it. I'm not referring to producing right-to-left books, that can easily be accomplished with the code, but to the code view itself. Specifically 2 things:

- Upon selecting "rtl mode", right-align everything (at least everything inside <body>). That is, visually align right, do not add "text-align" properties. This should also fix the placement of punctuation.

- Have the cursor move predictably: currently, pressing the left arrow key moves the cursor to the right , and vice-versa, when going over Hebrew letters. Maybe it will fix itself with the above change (?)

Obviously this will make it easier to work with Arabic too and any other rtl script.
Reply 

#2  KevinH 02-27-2021, 10:45 AM
Happy to incorporate patches changes and pull requests related to this but since I do not work in RTL I would be shooting in the dark. As for visual text alignment of code, where there is no alignment per se, I truly do not understand exactly what you are referring to.

A couple of images showing what you are looking for in a similar code editor that works the way you want, would be helpful.

Also if you do have a separate code editor that works the way you want, you may want to set it under "open with" in Sigil so you can more easily edit things with your editor of choice.
Reply 

#3  KevinH 02-27-2021, 11:29 AM
FWIW, CodeView is a QPlainTextEdit widget that uses a QTextDocument widget to hold the text being edited. A web search says that a QTextDocument has a method:

setDefaultTextOption(const QTextOption &option);

And one of the options allowed is text alignment. Setting that for Arabic and Hebrew to right to left might do what you want but I am not sure.

We can add that easily as Sigil subclasses QTextDocument. But would every person using Hebrew and Arabic want that changed? If not, and if it does what you want, we could allow an environment variable to control if it is used or not.
Reply 

#4  isaacbh 02-27-2021, 12:19 PM
Yes, this should be explicitely selected by the user, in whichever way you think is appropriate.
Reply 

#5  Doitsu 02-27-2021, 12:50 PM
Quote isaacbh
- Have the cursor move predictably: currently, pressing the left arrow key moves the cursor to the right , and vice-versa, when going over Hebrew letters. Maybe it will fix itself with the above change (?)
AFAIK, if you use dir="rtl" attributes, the cursor will automatically move in the way that you described.
At least it works like that with my test epub.
For example, if you click between Bet (ב) and Resh (ר) in the right-most word (בראשית), and press the right arrow key, the cursor will move to the left, which, IMHO, is the correct direction, if you're assuming the same logic that is applied to LTR text where pressing the right arrow will move the cursor to the next letter. (In Hebrew, the next letter is the letter left of the cursor.)

In MS Word, there's a Cursor movement option that allows users to switch between logical and visual cursor movement.
image »
Is that what you want KevinH to implement?
If so, the current behavior would be "logical cursor movement" and what you want is "visual cursor movement."

*I added text in parentheses for the benefit of KevinH.
Reply 

#6  isaacbh 02-27-2021, 01:23 PM
Quote Doitsu
In MS Word, there's a Cursor Movement option that allows users to switch between logical and visual movement.
image »
Is that what you want KevinH to implement?
If so, the current behavior would be "logical cursor movement" and what you want is "visual cursor movement."
Indeed, the "visual" mode sounds right to me. It's really confusing pressing left arrow and watching the cursor move to the right. But would it still behave normally with English text and with numbers? (Sorry, I don't have Word installed).
Reply 

#7  KevinH 02-27-2021, 01:26 PM
I still would love a screen shot of what CV in right align should look like and a xhtml file with Hebrew or Arabic in it to test with.

FWIW, I would be basing all of this on the **User-Interface**language selected and NOT on the language of the specific epub being edited as this would be a user interface feature.

Does that make sense or am I misunderstanding?
Reply 

#8  KevinH 02-27-2021, 01:28 PM
FWIW for documents with mixed languages, I could overwrite the key mapping to reverse them but I can not do that on a language/word basis within a single document. So you may have to live with what Qt supplies.
Reply 

#9  isaacbh 02-27-2021, 01:37 PM
Does that mean it can be disabled at least for non-xhtml files like stylesheets, content.opf etc? These do not have to have their behavior changed.
Reply 

#10  KevinH 02-27-2021, 01:43 PM
Not easily as they would all share the same QTextDocument class. If it is more correct for xhtml, why would it not be correct for the opf, and the ncx?

Again, it would really help to see a screenshot of any code editor editing xhtml that does the alignment the way you are suggesting. If none exist, this is probably not a change I am willing to make as it would be a change only one user would benefit from as opposed to a whole class of users.
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register