Term::resize 40 90
Term::check_box "source box after resize" 0 0 90 26
+
+# Check that resizing to less than 3 lines doesn't cause problems.
+foreach lines { 2 1 } {
+ with_test_prefix lines=$lines {
+ Term::resize $lines 90 0
+ Term::wait_for ""
+ Term::check_region_contents "has prompt" 0 0 90 $lines "$gdb_prompt"
+ }
+}
width = width_;
height = height_;
gdb_assert (m_window != nullptr);
+ if (width == 0 || height == 0)
+ {
+ /* The window was dropped, so it's going to be deleted, reset the
+ soon to be dangling pointer. */
+ m_window = nullptr;
+ return;
+ }
m_window->resize (height, width, x, y);
}
int available_size = m_vertical ? height : width;
int last_index = -1;
int total_weight = 0;
+ int prev = -1;
for (int i = 0; i < m_splits.size (); ++i)
{
bool cmd_win_already_exists = TUI_CMD_WIN != nullptr;
info[i].max_size = info[i].min_size;
}
+ if (info[i].min_size > info[i].max_size)
+ {
+ /* There is not enough room for this window, drop it. */
+ info[i].min_size = 0;
+ info[i].max_size = 0;
+ continue;
+ }
+
if (info[i].min_size == info[i].max_size)
available_size -= info[i].min_size;
else
/* Two adjacent boxed windows will share a border, making a bit
more size available. */
- if (i > 0
- && m_splits[i - 1].layout->last_edge_has_border_p ()
+ if (prev != -1
+ && m_splits[prev].layout->last_edge_has_border_p ()
&& m_splits[i].layout->first_edge_has_border_p ())
info[i].share_box = true;
+
+ prev = i;
}
/* If last_index is set then we have a window that is not of a fixed
/* See tui_layout_base::get_windows. */
void get_windows (std::vector<tui_win_info *> *windows) override
{
- windows->push_back (m_window);
+ if (m_window != nullptr && m_window->is_visible ())
+ {
+ /* Only get visible windows. */
+ windows->push_back (m_window);
+ }
}
protected: