aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/tui/tui-win.c13
2 files changed, 16 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 16daac3..feb5833 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2020-02-22 Tom Tromey <tom@tromey.com>
+ * tui/tui-win.c (tui_partial_win_by_name): Handle ambiguity
+ correctly.
+
+2020-02-22 Tom Tromey <tom@tromey.com>
+
* tui/tui-data.c (tui_next_win, tui_prev_win): Reimplement.
2020-02-22 Tom Tromey <tom@tromey.com>
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index ef78e91..ea20275 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -694,18 +694,27 @@ tui_scroll_right_command (const char *arg, int from_tty)
static struct tui_win_info *
tui_partial_win_by_name (gdb::string_view name)
{
+ struct tui_win_info *best = nullptr;
+
if (name != NULL)
{
for (tui_win_info *item : all_tui_windows ())
{
const char *cur_name = item->name ();
- if (startswith (cur_name, name))
+ if (name == cur_name)
return item;
+ if (startswith (cur_name, name))
+ {
+ if (best != nullptr)
+ error (_("Window name \"%*s\" is ambiguous"),
+ (int) name.size (), name.data ());
+ best = item;
+ }
}
}
- return NULL;
+ return best;
}
/* Set focus to the window named by 'arg'. */