src/terminal/tab.c (get_tab_by_number): Assert that the returned
struct window * actually points to a struct window.
src/terminal/tab.c (move_current_tab): Keep tabs contiguous in the
stack of windows. Obey "ui.tabs.wraparound".
src/terminal/terminal.h (struct terminal): Documented that tabs can
move in the stack.
src/terminal/window.c (assert_window_stacking): Check that the main
menu isn't between tabs.
This fixes the bug that tabs opened with -remote used to hide existing
dialogs, which then became unusable until the new tabs were closed.
src/terminal/tab.c (init_tab): Put the new tab immediately above
existing ones, or if it's the first one, then at the bottom of the stack.
Added assertions.
src/terminal/terminal.h (struct terminal): Redocumented the stacking
order of windows.
src/terminal/window.c [CONFIG_DEBUG] (assert_window_stacking): New function.
src/terminal/window.h (assert_window_stacking): New function or no-op macro.