* [PATCH] Fix tui new-layout -horizontal argument placement
@ 2025-11-29 17:40 Petar Popovic
2025-12-03 22:30 ` Tom Tromey
0 siblings, 1 reply; 3+ messages in thread
From: Petar Popovic @ 2025-11-29 17:40 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1700 bytes --]
From c3506f07eaf79a3c26e00bc6750708323cac4c99 Mon Sep 17 00:00:00 2001
From: Petar Popovic <pjoetri@gmail.com>
Date: Sat, 29 Nov 2025 17:41:30 +0100
Subject: [PATCH] Fix tui new-layout -horizontal argument placement
The optional argument `-horizontal` from `tui new-layout` is supposed
to be checked directly after the command but instead it is checked
after the layout name.
This commit moves the check to the correct place.
---
First time using an email list for patches.
Sorry for the previous "just copy/pasted" patches:
https://sourceware.org/pipermail/gdb-patches/2025-November/222937.html
https://sourceware.org/pipermail/gdb-patches/2025-November/223021.html
gdb/tui/tui-layout.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 95d20fbf22c..1dcd7086cac 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -1207,17 +1207,17 @@ validate_window_name (const std::string &name)
static void
tui_new_layout_command (const char *spec, int from_tty)
{
+ bool is_vertical = true;
+ spec = skip_spaces (spec);
+ if (check_for_argument (&spec, "-horizontal"))
+ is_vertical = false;
+
std::string new_name = extract_arg (&spec);
if (new_name.empty ())
error (_("No layout name specified"));
if (new_name[0] == '-')
error (_("Layout name cannot start with '-'"));
- bool is_vertical = true;
- spec = skip_spaces (spec);
- if (check_for_argument (&spec, "-horizontal"))
- is_vertical = false;
-
std::vector<std::unique_ptr<tui_layout_split>> splits;
splits.emplace_back (new tui_layout_split (is_vertical));
gdb::unordered_set<std::string> seen_windows;
--
2.52.0
[-- Attachment #2: Type: text/html, Size: 2225 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix tui new-layout -horizontal argument placement
2025-11-29 17:40 [PATCH] Fix tui new-layout -horizontal argument placement Petar Popovic
@ 2025-12-03 22:30 ` Tom Tromey
2025-12-04 10:04 ` Andrew Burgess
0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2025-12-03 22:30 UTC (permalink / raw)
To: Petar Popovic; +Cc: gdb-patches
>>>>> "Petar" == Petar Popovic <pjoetri@gmail.com> writes:
Petar> The optional argument `-horizontal` from `tui new-layout` is supposed
Petar> to be checked directly after the command but instead it is checked
Petar> after the layout name.
Petar> This commit moves the check to the correct place.
I wonder if this is really true or if it is just the "usage" line in the
doc string that is wrong.
I notice this form also isn't documented.
I tend to think it is better to fix the docs and not change the code
here, because overall I think the intent was for window layouts to have
more or less the same "shape", that is
tui new-layout name -horizontal ...
and
tui new-layout name {-horizontal ...}
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix tui new-layout -horizontal argument placement
2025-12-03 22:30 ` Tom Tromey
@ 2025-12-04 10:04 ` Andrew Burgess
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Burgess @ 2025-12-04 10:04 UTC (permalink / raw)
To: Tom Tromey, Petar Popovic; +Cc: gdb-patches
Tom Tromey <tom@tromey.com> writes:
>>>>>> "Petar" == Petar Popovic <pjoetri@gmail.com> writes:
>
> Petar> The optional argument `-horizontal` from `tui new-layout` is supposed
> Petar> to be checked directly after the command but instead it is checked
> Petar> after the layout name.
> Petar> This commit moves the check to the correct place.
>
> I wonder if this is really true or if it is just the "usage" line in the
> doc string that is wrong.
>
> I notice this form also isn't documented.
>
> I tend to think it is better to fix the docs and not change the code
> here, because overall I think the intent was for window layouts to have
> more or less the same "shape", that is
>
> tui new-layout name -horizontal ...
>
> and
>
> tui new-layout name {-horizontal ...}
Also, this has been around for a while, so making this change would
break existing users code, which we usually try to avoid.
I agree updating the docs would be better.
Thanks,
Andrew
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-04 10:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-29 17:40 [PATCH] Fix tui new-layout -horizontal argument placement Petar Popovic
2025-12-03 22:30 ` Tom Tromey
2025-12-04 10:04 ` Andrew Burgess
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox