]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
gdb/tui: add new 'tui window width' command and 'winwidth' alias
authorAndrew Burgess <aburgess@redhat.com>
Mon, 24 Jan 2022 22:02:59 +0000 (22:02 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Sun, 3 Apr 2022 14:15:09 +0000 (15:15 +0100)
commit160444ec7fd7c6df81826b8e06aa32a2ac1df856
tree203f32b2a5e84359ef9756ce50e1b5f64553eb6d
parentef466e0f0827555fcae21a905b3a2b9a6c0a5712
gdb/tui: add new 'tui window width' command and 'winwidth' alias

This commit adds a new command 'tui window width', and an alias
'winwidth'.  This command is equivalent to the old 'winheight'
command (which was recently renamed 'tui window height').

Even though I recently moved the old tui commands under the tui
namespace, and I would strongly encourage all new tui commands to be
added as 'tui ....' only (users can create their own top-level aliases
if they want), I'm breaking that suggestion here, and adding a
'winwidth' alias.

Given that we already have 'winheight' and have done for years, it
just didn't seem right to no have the matching 'winwidth'.

You might notice in the test that the window resizing doesn't quite
work right.  I setup a horizontal layout, then grow and shrink the
windows.  At the end of the test the windows should be back to their
original size...

... they are not.  This isn't my fault, honest!  GDB's window resizing
is a little ... temperamental, and is prone to getting things slightly
wrong during resizes, off by 1 type things.  This is true for height
resizing, as well as the new width resizing.

Later patches in this series will rework the resizing algorithm, which
should improve things in this area.  For now, I'm happy that the width
resizing is as good as the height resizing, given the existing quirks.

For the docs side I include a paragraph that explains how multiple
windows are required before the width can be adjusted.  For
completeness, I've added the same paragraph to the winheight
description.  With the predefined layouts this extra paragraph is not
really needed for winheight, as there are always multiple windows on
the screen.  However, with custom layouts, this might not be true, so
adding the paragraph seems like a good idea.

As for the changes in gdb itself, I've mostly just taken the existing
height adjustment code, changed the name to make it generic 'size'
adjustment, and added a boolean flag to indicate if we are adjusting
the width or the height.
gdb/NEWS
gdb/doc/gdb.texinfo
gdb/testsuite/gdb.tui/winwidth.exp [new file with mode: 0644]
gdb/tui/tui-layout.c
gdb/tui/tui-layout.h
gdb/tui/tui-win.c