From 06210ce428ad74c28fd94f7ea3800b79791cdefa Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 23 Jun 2019 20:39:57 -0600 Subject: [PATCH] Introduce can_scroll method This introduces a "can_scroll" method, removing a spot that explicitly checks a window's type. gdb/ChangeLog 2019-07-17 Tom Tromey * tui/tui-data.h (struct tui_win_info) : New method. (struct tui_cmd_window) : New method. * tui/tui-command.c (tui_dispatch_ctrl_char): Use can_scroll method. --- gdb/ChangeLog | 7 +++++++ gdb/tui/tui-command.c | 7 +++---- gdb/tui/tui-data.h | 11 +++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 701b2c90d04..28b0b5334c0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2019-07-17 Tom Tromey + + * tui/tui-data.h (struct tui_win_info) : New method. + (struct tui_cmd_window) : New method. + * tui/tui-command.c (tui_dispatch_ctrl_char): Use can_scroll + method. + 2019-07-17 Tom Tromey * ui-out.h (class ui_out) can_scroll ()) return ch; switch (ch) diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 412be1ce756..6a243c3d2f9 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -352,6 +352,12 @@ public: void left_scroll (int num_to_scroll); void right_scroll (int num_to_scroll); + /* Return true if this window can be scrolled, false otherwise. */ + virtual bool can_scroll () const + { + return true; + } + /* Can this window ever be highlighted? */ bool can_highlight = true; @@ -524,6 +530,11 @@ struct tui_cmd_window : public tui_win_info return CMD_NAME; } + bool can_scroll () const override + { + return false; + } + int start_line = 0; protected: -- 2.30.2