ios – NSTextView – utilizing up/down arrows strikes paragraphs not strains


I’ve an app that runs on iOS and makes use of UITextView to show wealthy textual content, and in addition runs on Mac and makes use of NSTextView to show wealthy textual content. These are separate apps, however with a number of shared code. In each instances, the {NS,UI}Textview is programmatically created and positioned on a canvas.

{NS,UI}TextView will wrap lengthy strains of textual content as required. Lengthy strains are known as paragraphs and have NSParagraphStyles that may be utilized throughout the entire paragraph (line spacing, head indent and so forth). Every paragraph is delineated by a “n” character (or one of many Unicode equivalents). Paragraphs wrap throughout a number of strains, if required.

On iOS, when you’ve an extended paragraph overlaying a number of strains… in the event you use the down/up arrow keys, the cursor strikes up and down by strains (i.e. presumably throughout the identical paragraph), which is as you anticipate.

On the Mac, with the identical setup, the up/down arrow keys transfer the cursor up and down by paragraphs (i.e. a number of strains), which could be very a lot not what you anticipate.

I’ve hooked up movies of the 2 cursor actions so you possibly can see what occurs.

I exploit the identical code to create the {NS,UI}TextView, and I can not see why there’s a distinction.

Does anybody know what is going on on right here? I’ve not interfered with the arrow key handlers in any approach (though I do implement textViewDidChangeSelection: within the delegate, and might affirm that the choice is altering per my feedback above).

Any concepts could be most appreciated!
Thx.

iOS Cursor Down in a UITextView.

iOS Cursor Down

Mac Cursor Down in an NSTextView.

Mac Cursor Down

Leave a Reply