How do I undo a grease pencil stroke caused by
in sculpt mode?
It seems like
will only affect the sculpting.
Yes, on Blender 2.79 Grease pencil "DRAW" is more like an annotation. (Obviously you can extend it to some animation functions). But yes, If you´re on the UV editor for example, and then D+Mouse drag, when you finish, you will not be able to "undo" the action. Just END the drawing, because you´re in a supra-mode. Supra-modes are direct override over the system in which -once you start a session with the tool- you can´t "undo" or "change tools" until you end it.
Other tools that work in the supra-mode are "C"ircle select. Once you enter into a circle select session you cannot undo. If you CTRL+Z, session ends. But you don´t undo. Then you CTRL+Z again, and Blender will take you back to the START of the "C" supra mode session select.
I work on 2.79.7B (Daily verision) and NOW you can DRAW (D) and then CTRL+Z. Check the version you have.
Thank you if you vote me up for answer.
I don't know a short cut, so I usually just delete the active grease pencil layer in the N panel. You are right, the undo system is only focused on the sculpt. Perhaps things will be different after the new grease pencil system has been used awhile in 2.8.