[Top][All Lists]

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

Re: Bug in NSAttributedString (?)

From: Richard Frith-Macdonald
Subject: Re: Bug in NSAttributedString (?)
Date: Sun, 3 Nov 2002 17:49:28 +0000

On Sunday, November 3, 2002, at 04:40  pm, Pierre-Yves Rivaille wrote:

The implementation of the shouldChangeTextInRange:replacementString: method clearly follows the apple doc. I believe the problem is in the replaceCharactersInRange:withString: method. This method should not call shouldChangeTextInRange:replacementString:. The apple doc says "This method must be invoked at the start of any sequence of user-initiated editing changes" which *probably* means that it should *only* be called on user-initiated changes. The same problem occurs in GNUMail. When no message is selected, the textview is sent a setString: @"" message, and this message is ignored because shouldChangeTextInRange:replacementString: responds NO.

I believe the same problems happens with -setFont:ofRange:, -setColor:ofRange: -setAlignment:ofRange:.

Certainly I agree there is nothing wrong with shouldChangeTextInRange:replacementString: and we should not change that just because if appears to fix the immediate problem. The idea that shouldChangeTextInRange:replacementString: should only be called for user initiated changes sounds plausible, but raises the question of what should be considered 'user initiated'. Perhaps any fairly direct response to
a mouse operation or a paste?

reply via email to

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