mirror of
https://github.com/tmux/tmux.git
synced 2026-10-07 02:04:22 +00:00
Add a second comparison for key bindings to avoid ties, GitHub issue
5647 from Alexandre Fiori.
(cherry picked from commit 86af3c8167)
This commit is contained in:
12
sort.c
12
sort.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: sort.c,v 1.10 2026/08/25 07:23:30 nicm Exp $ */
|
||||
/* $OpenBSD: sort.c,v 1.11 2026/09/28 09:41:53 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2026 Dane Jensen <dhcjensen@gmail.com>
|
||||
@@ -312,7 +312,7 @@ sort_key_binding_cmp(const void *a0, const void *b0)
|
||||
(b->key & KEYC_MASK_MODIFIERS);
|
||||
break;
|
||||
case SORT_NAME:
|
||||
result = strcasecmp(a->tablename, b->tablename) == 0;
|
||||
result = strcasecmp(a->tablename, b->tablename);
|
||||
break;
|
||||
case SORT_ACTIVITY:
|
||||
case SORT_CREATION:
|
||||
@@ -324,7 +324,13 @@ sort_key_binding_cmp(const void *a0, const void *b0)
|
||||
}
|
||||
|
||||
if (result == 0)
|
||||
result = strcasecmp(a->tablename, b->tablename) == 0;
|
||||
result = strcasecmp(a->tablename, b->tablename);
|
||||
if (result == 0) {
|
||||
if (a->key < b->key)
|
||||
result = -1;
|
||||
else if (a->key > b->key)
|
||||
result = 1;
|
||||
}
|
||||
|
||||
if (sort_crit->reversed)
|
||||
result = -result;
|
||||
|
||||
Reference in New Issue
Block a user