mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-20 07:43:36 +08:00
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 <tom@tromey.com> * tui/tui-data.h (struct tui_win_info) <can_scroll>: New method. (struct tui_cmd_window) <can_scroll>: New method. * tui/tui-command.c (tui_dispatch_ctrl_char): Use can_scroll method.
This commit is contained in:
parent
381befeedf
commit
06210ce428
@ -1,3 +1,10 @@
|
||||
2019-07-17 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* tui/tui-data.h (struct tui_win_info) <can_scroll>: New method.
|
||||
(struct tui_cmd_window) <can_scroll>: New method.
|
||||
* tui/tui-command.c (tui_dispatch_ctrl_char): Use can_scroll
|
||||
method.
|
||||
|
||||
2019-07-17 Tom Tromey <tromey@adacore.com>
|
||||
|
||||
* ui-out.h (class ui_out) <field_signed, field_fmt_signed,
|
||||
|
@ -48,10 +48,9 @@ tui_dispatch_ctrl_char (unsigned int ch)
|
||||
if (ch == '\f')
|
||||
tui_refresh_all_win ();
|
||||
|
||||
/* If the command window has the logical focus, or no-one does
|
||||
assume it is the command window; in this case, pass the character
|
||||
on through and do nothing here. */
|
||||
if (win_info == NULL || win_info == TUI_CMD_WIN)
|
||||
/* If no window has the focus, or if the focus window can't scroll,
|
||||
just pass the character through. */
|
||||
if (win_info == NULL || !win_info->can_scroll ())
|
||||
return ch;
|
||||
|
||||
switch (ch)
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user