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



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 numerous shared code. In each instances, the {NS,UI}Textview is programmatically created and positioned on a canvas.

{NS,UI}TextView will wrap lengthy traces of textual content as required. Lengthy traces are referred to 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 traces, if required.

On iOS, when you have got an extended paragraph protecting a number of traces… if you happen to use the down/up arrow keys, the cursor strikes up and down by traces (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 traces), which could be very a lot not what you anticipate.

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

I take advantage of 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 method (though I do implement textViewDidChangeSelection: within the delegate, and may affirm that the choice is altering per my feedback above).

Any concepts could be most appreciated!

iOS Cursor Down in a UITextView.

iOS Cursor Down

Mac Cursor Down in an NSTextView.

Mac Cursor Down



Please enter your comment!
Please enter your name here