[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Layout manager, text view and selection

From: Quentin Mathé
Subject: [PATCH] Layout manager, text view and selection
Date: Sat, 15 May 2004 23:41:03 +0200

Hi everybody,

For Alex M., I want to add that I have found this problem consequently to my question about NSOldSelectedCharacterRange on #gnustep, contrary to my conclusions at this time, it's not my changes in NSTextView which induced that NSOldSelectedCharacterRange is sometimes not correct, it is really a "hole" in the current implementation of the NSLayoutManager.

The NSLayoutManager selection management in GNUstep is not correct, and it doesn't follow the Cocoa behavior which is logical : when there is a text related action, update the selection in each piece of the text system. Actually the layout manager selection is always updated but it's not always propagated to the text view. In the current state when the NSTextView method -insertText: is called, the layout manager in the method textStorage:edited:range:changeInLength:invalidatedRange: sets the selected range to the new range… then when the method setSelectedRange: is called we obtain the new range for the old one because the layout manager selected range has already been updated. In fact, the layout manager selected range should be updated by the text views which are bound to it and the layout manager should keep the old selected range to provide it to the text view when the layout manager calls -setSelectedRange: on NSTextView. The text system in Cocoa implements this interaction scheme.

To have a correct NSOldSelectedCharacterRange value in the textViewDidChangeSelection notification and to have also this notification sent always when it should be (like when we call replaceCharactersInRange:withString:), here are 3 patches to implement the new behavior :

Attachment: NSLayoutManager.m.patch
Description: Binary data

Attachment: NSTextView_actions.m.patch
Description: Binary data

Attachment: NSTextView.m.patch
Description: Binary data

Quentin Mathé

reply via email to

[Prev in Thread] Current Thread [Next in Thread]