There is no indication whether the current script has been saved yet. I suggest to disable the save button when no unsaved changes exist and only enable it when the script is changed. The code is in scripting/java/com/sun/star/script/framework/provider/beanshell . You find the Beanshell Editor via Tools->Macros->Organize Macros->Beanshell. Create a library, then a macro, then you can edit it which gets you into the Beanshell Editor.
Sainal Shah committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/+/f480c6cb7f41bf38a2259dface77b8cca87ce6ec%5E%21 tdf#123588 Beanshell editor to indicate whether script is saved It will be available in 6.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.