Cursor Position

Whenever I open a script that’s been saved with Script Debugger, the cursor is always at the bottom of the script, and I wondered if there’s any way to change that? My preference is that the cursor be at the top of the script. I’m using Script Debugger 8.0.1. Thanks.

Is the same in the Script Editor and for me ok, because you might want to continue the script.

The cursor is where it was when you closed the document.

I like it very much that I can open a script and see the last position, so if this would be changed then please make it optional.

Thanks Dirk and Pete for the responses. I just tested opening a very-long script with Script Editor and Script Debugger.

With Script Editor, the screen shows the very-top of the script but the cursor is at the very bottom of the script. With Script Debugger, the screen shows the very-bottom of the script and the cursor is at the very bottom of the script. In neither case is the cursor or the screen at the last-edited or last-viewed point of the script.

I’m new to Script Debugger and thought there might be some setting that I had missed. Fortunately,Script Debugger is easy to script and I’ll fix things as I want that way.

BTW, this is with macOS Catalina and Script Debugger 8.0.1.

Script Debugger 8.0.1
macOS 10.14.6 Mojave

Script Debugger remembers the selection and scroll position whenever you save a document. When you re-open, this will be restored.

We do not offer a preference setting to change this behaviour.

Thanks Mark for explaining how Script Debugger is designed to work, which certainly makes sense.

Just to insure I wasn’t confused in some respect, I created a new script and entered enough code to fill three windows of Script Debugger. I then saved the script, quit Script Debugger, and then opened the script in Script Debugger. The last code I had entered was at the end of the script, and so, as expected, the screen displayed the bottom of the script and the cursor was also at the bottom of the script.

I then scrolled up to the middle screen of the script and entered two new lines of code, after which I immediately saved the script and quit Script Debugger. I then opened that script and Script Debugger displayed the bottom of the script and the cursor was at the bottom of the script.

I obviously don’t question what you say, and there must be some reason I am seeing a different behavior. Perhaps I modified some other macOS or Script Debugger setting that is causing this. I’ll test different setting to see if I can ascertain the cause. Thanks again.

I did some additional testing as to when a script’s scroll and cursor positions are remembered by Script Debugger. The methods I used to open the script include selecting File > Open from within Script Debugger, Finder’s Open command, the do-shell-script command with the shell’s open command, and double-clicking on the script in a Finder window or on the desktop.

In every case the script’s scroll and curosr positions were remembered if a Script Debugger window was open, and the script’s scroll and cursor positions were NOT remembered if a Script Debugger window was not open. The Script Debugger window could contain no code–just having Script Debugger running fixed the issue.

I normally open a script by double-clicking a script on the desktop and Script Debugger is typically not running. So, I’ll just use the Script Debugger script I mention above and that will fix things for me. This was my only issue with Script Debugger and it’s good to have this resolved.

I just reviewed my earlier posts in this thread and found that they are confusing. So, FWIW, I thought I would restate the issue.

If I double click on a script on the desktop and Script Debugger is NOT running, the script is opened but Script Debugger does not restore the selection and scroll position from the last save. Instead, the bottom of the script is displayed.

If I double click on a script on the desktop and Script Debugger is running (regardless of the document displayed), the double-clicked script is opened and Script Debugger does restore the selection and scroll position from the last save.

Mark has answered my primary question when I started this thread, which was the thought that there might be a preference setting that controls the above behavior. That’s not the case so everything is fine.

With the 8.0.6 update, cursor position is no longer retained when saving. The cursor ends up at the top of the script window. Was this change intentional or a regression? Either way, I’d vote to go back to retaining the cursor position when saving.

1 Like