From cd409aaefef8e810d2842f0061e1f7572f4d518a Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 23 Aug 2024 10:19:06 +0000 Subject: [PATCH] Check for exact match for layout name before looking for a prefix match. --- usr.bin/tmux/layout-set.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.bin/tmux/layout-set.c b/usr.bin/tmux/layout-set.c index 40501964e91..77eca1a92b5 100644 --- a/usr.bin/tmux/layout-set.c +++ b/usr.bin/tmux/layout-set.c @@ -1,4 +1,4 @@ -/* $OpenBSD: layout-set.c,v 1.31 2024/08/21 05:03:13 nicm Exp $ */ +/* $OpenBSD: layout-set.c,v 1.32 2024/08/23 10:19:06 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott @@ -55,6 +55,10 @@ layout_set_lookup(const char *name) u_int i; int matched = -1; + for (i = 0; i < nitems(layout_sets); i++) { + if (strcmp(layout_sets[i].name, name) == 0) + return (i); + } for (i = 0; i < nitems(layout_sets); i++) { if (strncmp(layout_sets[i].name, name, strlen(name)) == 0) { if (matched != -1) /* ambiguous */ -- 2.20.1