Question about which script is focused after closing another script.
How does LinqPad decide which script to switch to whenever I close a script?
Most of the time it is the previously selected script, but not always.
Is it based on the length of time spent active?
If so what is the time limit?
Best Answer
-
It seems to work correctly for me. Note that the behavior will depend on whether you release the control key between steps 3 and 4. If you release the control key, the newly selected script will registry as being "used". But if you keep the control key held down, LINQPad will ignore the intermediate selection and only register the script that's active when the control key is released.
Answers
-
It should be the previously selected script unless you're restored from a previous session, in which case it will be tab to the left. There's no time limit.
-
This is how I reproduced it.
- Start a new clean LinqPad Session.
- Press Ctrl-N twice to open two new scripts
- Press Ctrl-PgDn to switch to Script 1
- Press Ctrl-PgDn again to switch to Script 2
- Close script 2
It switches to script 3 whereas I would expect to switch back to script 1.
However if I change script 1 between stages 3 and 4 then it works as I would expect. But it isn't as simple as working if script 1 is dirty/changed as it does not work if I make changes to it before stage 2.
If I open 20 scripts and go through them all to script 14 and close 14, it doesn't go back to 13 but 20 (at least in this test).
Note, this is on the latest beta, but it is not a new problem and probably goes back years.
It's only a minor irritation and only seems to happen when I am going quickly through scripts rapidly using Ctrl-PgDn which is why I was wondering if it was related to the time spent.
-
That would explain it as I was keeping the control key held down and just pressing PgDn
Now that I know how it works, I can easily control it to do what I want.
Thanks
