When the macro finishes it gives me an untitled file. The drawer shows a complete set of styles, which are clearly the styles from my "Nisus New File". But when I switch to the style sheet, there are only 3 styles (Header, Footer, Normal); no character styles, no list styles, no note styles. Obviously this is some kind of bug. There are two questions here.
Where do these default styles come from?
Why the mismatch between the drawer and the style sheet?
But what is your $newDoc? If any portion of that text object does not have a defined style, what occurs in opening a plain text file or an rtf file without defined styles (e.g. those created by TextEdit) occurs: the text content formatted according to your settings in Preferences - New File - Format, with Normal style imported from your default dot file without being applied.
If the text object has originated from an existing NWP document (and has been treated as attributed text), the defined styles —at least all styles actually used — will be preserved in a new document thus created.
I don’t seem to have the drawer oddity but, concerning something else and at times, I have noticed NWP’s slowness in refreshing information.
phspaelti wrote:1. Where do these default styles come from?
In the absence of normal/header/footer styles in the provided text, a new document will automatically generate those styles (by copying them from your new file template).
Why the mismatch between the drawer and the style sheet?
This would be an updating bug peculiar to the macro command. I'll file it for fixing, thanks.
So Nisus will create a new document containing the the text "Hello World". The style sheet for that document (for me) looks like this with the drawer open. As you can see on the left there are 3 styles, and on the right a couple more. The list on the right seems to be the style sheet from my Nisus New File.
Screen_capture_new_doc_style_bug.jpg (77.75 KiB) Viewed 9990 times
I see what you are saying. But it happens in saved macros too, if the text used to create the new document comes from a string as opposed to text. So the following macro shows the problem if even it is saved and run from the menu: