diff options
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/tui/tui-data.h | 5 | ||||
-rw-r--r-- | gdb/tui/tui-win.c | 24 |
3 files changed, 31 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c8850c1..174d12b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2019-06-25 Tom Tromey <tom@tromey.com> + * tui/tui-win.c (tui_win_info::max_height) + (tui_cmd_window::max_height): New methods. + (new_height_ok): Call max_height. + * tui/tui-data.h (struct tui_win_info, struct tui_cmd_window) + <max_height>: New method. + +2019-06-25 Tom Tromey <tom@tromey.com> + * tui/tui-win.c (tui_source_window_base::set_new_height) (tui_data_window::set_new_height): New methods. (make_invisible_and_set_new_height): Call set_new_height method. diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 07ec977..08b0dad 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -273,6 +273,9 @@ public: { } + /* Compute the maximum height of this window. */ + virtual int max_height () const; + /* Methods to scroll the contents of this window. Note that they are named with "_scroll" coming at the end because the more obvious "scroll_forward" is defined as a macro in term.h. */ @@ -426,6 +429,8 @@ struct tui_cmd_window : public tui_win_info { } + int max_height () const override; + int start_line = 0; protected: diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index fe1e901..dc40ab7 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -1377,6 +1377,22 @@ make_visible_with_new_height (struct tui_win_info *win_info) } +/* See tui-data.h. */ + +int +tui_win_info::max_height () const +{ + return tui_term_height () - 2; +} + +/* See tui-data.h. */ + +int +tui_cmd_window::max_height () const +{ + return tui_term_height () - 4; +} + static int new_height_ok (struct tui_win_info *primary_win_info, int new_height) @@ -1391,12 +1407,8 @@ new_height_ok (struct tui_win_info *primary_win_info, diff = (new_height - primary_win_info->generic.height) * (-1); if (cur_layout == SRC_COMMAND || cur_layout == DISASSEM_COMMAND) { - ok = ((primary_win_info->generic.type == CMD_WIN - && new_height <= (tui_term_height () - 4) - && new_height >= MIN_CMD_WIN_HEIGHT) - || (primary_win_info->generic.type != CMD_WIN - && new_height <= (tui_term_height () - 2) - && new_height >= MIN_WIN_HEIGHT)); + ok = (new_height <= primary_win_info->max_height () + && new_height >= MIN_CMD_WIN_HEIGHT); if (ok) { /* Check the total height. */ struct tui_win_info *win_info; |