Strange cursor behavior around Hebrew characters


#1

Taskpaper 3.2.1 build 207

On this build, the cursor disappears if it is adjacent to a Hebrew character. On the 203 build I was on before updating, it was weirder than that; the cursor would split in two, the top half before the character and the bottom half after, or something.

This probably happens around other high Unicode characters, but I haven’t tested them.

Example character this happens with: ג


#2

I wonder if that depends on the font ?

I’ve seen something curious when higher Unicode characters (new Emoji) etc need two backspaces for deletion, but my cursor and extended selections, seem to be looking ok at the moment in Hebrew (TaskPaper 3 build 207)

Is this is kind of adjacency that you have in mind ?


#3

Yeah. I wonder which font it’s pulling the Hebrew from on my machine; I don’t know how to tell that.


#4

From the TaskPaper 3 menu:

Choose File > Open Application Folder

And then open the the theme.less file to look at or edit @font-family settings

( ‘Source Sans Pro’ in the screenshot above )

See:

http://guide.taskpaper.com/creating_themes.html


#5

Yeah, my font is Source Sans Pro, but the Hebrew character is probably not in that font and is being pulled from a substitute, as OS X does. Right?


#6

Good question – I think I had imagined that the standard fonts included אב characters.

The system seems to come with Arial Hebrew, Corsiva Hebrew, New Peninim, Raanana, but I don’t know what the mechanisms are for determining which is pulled out. Perhaps Jesse has an idea.


#7

Yeah. Further complicating matters is that I have Adobe Creative Cloud installed, with Photoshop etc., and that comes with a bunch of multilingual fonts that may make the substitution different on my computer than on a normal person’s.


#8

Just testing this out in TextEdit… and wow I never knew the cursor did that! :slight_smile:

I think I’ve hacked around the problem, wasn’t a font thing I think. Instead I’m overriding some cursor drawing stuff. And when I ask for the rect for the range at that position I get an empty rect… odd. I have no idea what is going on, but I’ve just fixed things so that it works like TextEdit I think.


#9

Boy, TextEdit has weird behavior too! Putting spaces after the letter adds the spaces but leaves the cursor in place. Definitely looks more like a bad LTR/RTL inference conflict or something.


#10

What is the correct behavior? Can you give me some example text that demonstrates the various problems? If TextEdit doesn’t get it right it’s quite possible I won’t be able to either. But would be nice to know the right behavior.

Does Pages.app get it right?


#11

Okay, I see what’s going on here. TextEdit’s behavior is making a lot more sense to me now.

First of all, the split cursor in TextEdit is actually almost certainly on purpose. When you start typing characters in an RTL script in the middle of an LTR line, any successive RTL characters are added in RTL order. But the moment you type a space or a Latin character, both TextEdit and Pages jump the cursor to the right of the RTL string and resume typing in normal LTR mode. So the split cursor means “If the next thing you type is RTL, it goes on this side, but if not, it goes on the other.”

In TaskPaper 3.2.1.207, the cursor just disappears, so the split cursor behavior from build 203 is probably the correct behavior.

BUT, the disappearing cursor is not actually my main problem, it was just the simplest aspect to describe. The actual problem is when I use Shift+Arrow keys to select text around the Hebrew letters. TextEdit and Pages get this right, but TaskPaper does very weird stuff.

To replicate, type several lines of normal English, then put a few Hebrew characters at the end of a line. Then, with your cursor at the end of the line (and invisible), hold Shift and keep arrowing to the left. At random–seeming points, the right end of the selection will jump to the left a whole bunch of characters, deselecting stuff that was originally selected.


#12

@75th,
Could you try switching your Taskpaper theme font to another font that is more Hebrew friendly?I couldn’t see that problem using “Universal.” Ezra SIL works pretty good and is freely available

The curious thing is that I read this post after taking a break from trying to grasp the ideas and concepts behind the word "כבד"in Hebrew because Mother’s day is coming up in America.

Would you be interested in helping me understand the word? You can private message me if you want, if not, no problem.

Hope you figure out your problem

שלום


#13

Do you remember if that worked in earlier versions? I know how to fix the missing cursor, but I don’t think that fix will change any editing behavior.


#14

Mellel is an app with good RTL behaviour, FWIW

(you can toggle between its RTL and LTR behaviour with a button in the toolbar)


#15

I’m not sure about Mellel, but I think it might not be using NSTextView as a base. At least it doesn’t seem to have the split cursor behavior that TextEdit (and now last TaskPaper preview) have when editing this line:

חקjesseדדק

And placing the text caret right before the “j”.

Anyway I think the latest TaskPaper Preview (208) should be back to TaskPaper 3.2 editing behavior. But I’m also pretty sure that it also doesn’t really support right to left text very well. When I type in Hebrew I notice that the item bullet is rendered in wrong location, and also that the paragraph invisible is rendered in the wrong position.

I’ve added a general “Support Right to Left Text” item into my list, but I don’t expect to make much progress on it in the near future. Please do let me know if there’s some huger bug that you think I can easily fix with right to left texts. But generally I think it’s a big job that needs quite a bit more investigation. I’m not even sure what a mixed text direction outline would look like. Where would bullets go, guide lines, how exactly would the structure be visualized.