Re: NSTextView scrolls to top when text storage changes
Re: NSTextView scrolls to top when text storage changes
- Subject: Re: NSTextView scrolls to top when text storage changes
- From: Martin Hewitson <email@hidden>
- Date: Sat, 07 Jul 2012 07:36:57 +0200
OK, I found the problem. Turns out I had left the textview associated with more than one textstorage. I'm surprised that this was the only symptom. In detail, when switching tabs in the editor, I forgot to remove the textview from all other text containers before assigning it to the file associated with the new tab. Silly.
Martin
On 7, Jul, 2012, at 06:47 AM, Martin Hewitson wrote:
> Dear List,
>
> I have a document managing app which has a project search feature for searching through the project's managed files (see thread "Dynamic modification of text search results" earlier this week).
>
> When I find search matches I add an attribute to the textstorage in which the search term was found. For the file/textstorage that is currently displayed in the editor (the NSTextView), this has the consequence of scrolling the text view to the top. The selection is not changed - just the scrollview jumps to the top.
>
> I assume this must be a bug. I've checked every place in the code where I respond to NSTextStorageDidProcessEditingNotification, and none of these is responsible for the scrolling.
>
> Has anyone else seen this behaviour? Is this a known issue? If so, is there a workaround?
>
> Many thanks,
>
> Martin
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden