mirror of
https://github.com/tmux/tmux.git
synced 2026-10-08 19:14:20 +00:00
Do not use subtraction for comparators, this doesn't really matter for
IDs but it breaks key sorting. GitHub issue 5646 from Alexandre Fiori.
This commit is contained in:
14
hyperlinks.c
14
hyperlinks.c
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: hyperlinks.c,v 1.5 2026/06/29 16:44:06 nicm Exp $ */
|
||||
/* $OpenBSD: hyperlinks.c,v 1.6 2026/09/28 10:42:01 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2021 Will <author@will.party>
|
||||
@@ -88,7 +88,11 @@ hyperlinks_by_uri_cmp(struct hyperlinks_uri *left, struct hyperlinks_uri *right)
|
||||
return (-1);
|
||||
if (*right->internal_id != '\0')
|
||||
return (1);
|
||||
return (left->inner - right->inner);
|
||||
if (left->inner < right->inner)
|
||||
return (-1);
|
||||
if (left->inner > right->inner)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
r = strcmp(left->internal_id, right->internal_id);
|
||||
@@ -105,7 +109,11 @@ static int
|
||||
hyperlinks_by_inner_cmp(struct hyperlinks_uri *left,
|
||||
struct hyperlinks_uri *right)
|
||||
{
|
||||
return (left->inner - right->inner);
|
||||
if (left->inner < right->inner)
|
||||
return (-1);
|
||||
if (left->inner > right->inner)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
RB_PROTOTYPE_STATIC(hyperlinks_by_inner_tree, hyperlinks_uri, by_inner_entry,
|
||||
hyperlinks_by_inner_cmp);
|
||||
|
||||
Reference in New Issue
Block a user