Confusing main/sub view behavior
I often get the following annoying problem:
I have multiple tabs opened in a single view.
I drag a single tab into the view and the pop up of move/clone to other view opens.
I choose ‘Move’.
I expect the tab to open in the right view while all other tabs remain in left view.
However, sometimes the tab opens in the left view and all other files tabs move to the right view.
The reason for this is that a few days ago I had 2 views opened and I closed all tabs in the left view. I forgotten all about it but NPP still remembers that the single view that I see is the ‘sub view’. I (the user) have no way of knowing that.
It would be rally nice if during a 2 view session when the last file in a view is closed the remaining single view will become the main view regardless of what it was before.
Yes, there seems to be some buggy behavior with the views in this and similar situations. For example, if you have a single file open in the main view, you can’t move it to the secondary view. THAT seems like good behavior if one considers that the design criterion is that at least one file must be open at all times in the main view.
But, as you (and I) have noticed, it is possible to get one (or more) files open in the secondary view with NO files open in the primary view.
If you use the pythonscript plugin, you can switch to the console window and type:
This will return a 0 (main view) or 1 (secondary view) based upon which view the current editor tab is in; thus, even when you THINK a tab is in the main view, you may see a 1 returned (meaning you are not).
And…I totally agree with your last statement: “It would be really nice if…” !
Start NPP (the current view is MAIN (0)).
Open two files and Compare.
Close the file at the top (or left).
You are still in MAIN_VIEW.
I suppose this result (for a general use) may be achieved with a Python Script.
It appears the difficulties with the Views goes deeper than I had thought.
Pythonscript has its own difficulties with view-handling (https://github.com/bruderstein/PythonScript/issues/22) that make some things I currently want to do with it impossible. :(
Indeed. The Views handling can be improved.
It gets worse…I just noticed that the Window menu (in the main menu bar) doesn’t know about more than one view at a time. For instance, if the current editor tab is one in the main view, then invoking the Window menu only gives you choices of other windows from the main view. It works similarly for when the active editor tab is in the secondary view (can only move to another window in the secondary view) when the Window menu is invoked.
That’s a nice observation.
And another point:
Tabs from other windows are not displayed.
So the window title should be “Window Tabs” instead of “Windows” and the command “Close window(s)” should be “Close tab(s)”.