mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 00:59:15 +08:00
Introduce function for directly updating GDB's screen dimensions
... to replace the roundabout pattern of execute_command ("set width %d"); execute_command ("set height %d"); for doing the same thing. gdb/ChangeLog: * utils.h (set_screen_width_and_height): Declare. * utils.c (set_screen_width_and_height): Define. * tui/tui-win.c (tui_update_gdb_sizes): Use it.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2015-04-28 Patrick Palka <patrick@parcs.ath.cx>
|
||||||
|
|
||||||
|
* utils.h (set_screen_width_and_height): Declare.
|
||||||
|
* utils.c (set_screen_width_and_height): Define.
|
||||||
|
* tui/tui-win.c (tui_update_gdb_sizes): Use it.
|
||||||
|
|
||||||
2015-04-28 Gary Benson <gbenson@redhat.com>
|
2015-04-28 Gary Benson <gbenson@redhat.com>
|
||||||
|
|
||||||
* infrun.c (solist.h): New include.
|
* infrun.c (solist.h): New include.
|
||||||
|
@ -465,15 +465,20 @@ bold-standout use extra bright or bold with standout mode"),
|
|||||||
void
|
void
|
||||||
tui_update_gdb_sizes (void)
|
tui_update_gdb_sizes (void)
|
||||||
{
|
{
|
||||||
char cmd[50];
|
int width, height;
|
||||||
|
|
||||||
/* Set to TUI command window dimension or use readline values. */
|
if (tui_active)
|
||||||
xsnprintf (cmd, sizeof (cmd), "set width %d",
|
{
|
||||||
tui_active ? TUI_CMD_WIN->generic.width : tui_term_width());
|
width = TUI_CMD_WIN->generic.width;
|
||||||
execute_command (cmd, 0);
|
height = TUI_CMD_WIN->generic.height;
|
||||||
xsnprintf (cmd, sizeof (cmd), "set height %d",
|
}
|
||||||
tui_active ? TUI_CMD_WIN->generic.height : tui_term_height());
|
else
|
||||||
execute_command (cmd, 0);
|
{
|
||||||
|
width = tui_term_width ();
|
||||||
|
height = tui_term_height ();
|
||||||
|
}
|
||||||
|
|
||||||
|
set_screen_width_and_height (width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
12
gdb/utils.c
12
gdb/utils.c
@ -1795,6 +1795,18 @@ set_height_command (char *args, int from_tty, struct cmd_list_element *c)
|
|||||||
set_screen_size ();
|
set_screen_size ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See utils.h. */
|
||||||
|
|
||||||
|
void
|
||||||
|
set_screen_width_and_height (int width, int height)
|
||||||
|
{
|
||||||
|
lines_per_page = height;
|
||||||
|
chars_per_line = width;
|
||||||
|
|
||||||
|
set_screen_size ();
|
||||||
|
set_width ();
|
||||||
|
}
|
||||||
|
|
||||||
/* Wait, so the user can read what's on the screen. Prompt the user
|
/* Wait, so the user can read what's on the screen. Prompt the user
|
||||||
to continue by pressing RETURN. */
|
to continue by pressing RETURN. */
|
||||||
|
|
||||||
|
@ -174,6 +174,10 @@ extern struct ui_file *gdb_stdtarg;
|
|||||||
extern struct ui_file *gdb_stdtargerr;
|
extern struct ui_file *gdb_stdtargerr;
|
||||||
extern struct ui_file *gdb_stdtargin;
|
extern struct ui_file *gdb_stdtargin;
|
||||||
|
|
||||||
|
/* Set the screen dimensions to WIDTH and HEIGHT. */
|
||||||
|
|
||||||
|
extern void set_screen_width_and_height (int width, int height);
|
||||||
|
|
||||||
/* More generic printf like operations. Filtered versions may return
|
/* More generic printf like operations. Filtered versions may return
|
||||||
non-locally on error. */
|
non-locally on error. */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user