cappuccino / cappuccino

Web Application Framework in JavaScript and Objective-J
https://cappuccino.dev/
GNU Lesser General Public License v2.1
2.21k stars 335 forks source link

CPTextField edit cursor does not always flash - Fix included. #841

Closed BlairDuncan closed 14 years ago

BlairDuncan commented 14 years ago

This may be browser specific, but it happens in Safari and has bugged me for some time.

If you never setSelectable:YES the cursor will not flash - even though its been made editable.

The docs for NSTextField for setEditable say: ... If YES, then the user is allowed to both select and edit text. If flag is NO, then the user isn’t permitted to edit text, and the receiver’s selectability is restored to its previous value.

So the fix is to simply add setSelectable:YES to the setEditable method.

if(shouldBeEditable)
    _isSelectable = YES;
Me1000 commented 14 years ago

Interesting... It would be nice to know what is causing this in webkit... I guess the only thing now is to make sure isSelectable returns yes if you setEditable for NSTextField. I would assume yes... One more test to see what happens when you setSelectable:NO then setEditable:YES, then test once more whenyou setEditable:NO again.

BlairDuncan commented 14 years ago

Yes, that is why selectable should only get set to YES when it is being set as editable.

This is explained in the NSTextField docs ...For example, if an NSTextField object is selectable but not editable, then made editable for a time, then made not editable, it remains selectable. To guarantee that text is neither editable nor selectable, simply use setSelectable: to turn off selectability.

Me1000 commented 14 years ago

Thanks, I'll grab this when I get a chance.

BlairDuncan commented 14 years ago

Commit is here: http://github.com/BlairDuncan/cappuccino/commit/88c80b8f2ab7397cb3086c718dfaecac7c99c94e

Me1000 commented 14 years ago

Pulled, thanks! :)