The problem in every respect is the undo stack.
Here is another solution I have been pondering upon: if annotations or footnotes are collapsed, Scrivener could iterate through all such ranges of text and replace them with an icon. This icon would hold the text of the annotation until the annotations (or footnotes) were uncollapsed.
But this - as with Amber’s font-changing suggestion - causes problems for the undo manager. If Scrivener goes through and replaces all such text ranges with icons, what happens when you hit “Undo”? All of the text is now in different places, so the undo manager will become confused. You might suggest that at this point, “Undo” could undo the annotation/footnote collapsing… Okay, that would work fine - until you change documents. Suppose you collapse annotations in one document, then open another document. When you open that document, you will expect the annotations to be collapsed now, as the setting should be global for all documents in the project. Now, that document has its own undo stack - so maybe now you open the document and hit “Undo”. The undo manager will panic, because text that was there before is no longer there - having been replaced by icons - meaning that it could be trying to reset a range of text that is beyond the length of the text. Even if the undo manager does not crash the program, it most certainly will replace the wrong piece of text.
The obvious - easy - solution to this would be to reset all text undo managers when you choose to collapse or uncollapse footnotes or annotations. There could be a warning message the first time you do this.
And incidentally, if you don’t know what I mean by all of this undo fuss, you can already test it out - I just realised there is a bug in Scrivener which I need to fix for 1.04 along these lines. Open up a new project and create two documents. Enter text in both documents, then open them both up in an E.S. session and delete the text from one of the documents. Now open up that document on its own again, click into the text view, hit “Undo” and then - assuming Scrivener doesn’t crash - open up Console.app via Spotlight. You will see that Scrivener’s undo manager has spewed an error. This is because you edited text in Edit Scrivenings and Scrivener didn’t tell the text’s own undo manager about the change. The only way around this may well be that, upon entering an E.S. session, the undo stacks of each of the text documents in the session may need to be reset.
The problem here is really one with Cocoa, in that all of the undo stuff is handled at the view level. It is the text view that registers all of the undo stuff, not the underlying text itself. And thus the text has to be in a text view for undo to work properly.
So, to put it simply: I could very easily implement a system whereby annotations and footnotes are collapsible, but only at the cost of the undo stack for each document being reset when they are collapsed and uncollapsed. Of course, undo is hardly perfect in any app, so it may be that this is an acceptable cost for the feature, especially if there is a warning.
The other issue, of course, is that if you want to add an annotation or footnote and they are collapsed, Scrivener will need to uncollapse them automatically. The collapse/uncollapse thing would have to affect all of them.
Incidentally, another idea might be for footnotes just to be translucent until the mouse is over them. That would just be a display thing and wouldn’t have to touch the undo stack… But it would just be about softening the current implementation rather than doing anything different.
Best,
Keith