aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-02-10 22:19:51 +0800
committerGitHub <noreply@github.com>2024-02-10 22:19:51 +0800
commit470c450fd258ded6200305d28b35e7243520595f (patch)
treeec1bde5294d6227a435c20979e32c7bfd4e74ec8 /src/nvim/window.c
parent71429c90eeb979c6062ee845e516d28b5e6ce402 (diff)
parent00e785b17fde8c476031e3c24ea77bed45b88a89 (diff)
downloadrneovim-470c450fd258ded6200305d28b35e7243520595f.tar.gz
rneovim-470c450fd258ded6200305d28b35e7243520595f.tar.bz2
rneovim-470c450fd258ded6200305d28b35e7243520595f.zip
Merge pull request #27418 from zeertzjq/vim-9.1.0089
vim-patch:9.1.{0089,0093}: qsort() comparison function fixes
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index a188d75000..15bd1212ad 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -7359,9 +7359,17 @@ static bool frame_check_width(const frame_T *topfrp, int width)
}
/// Simple int comparison function for use with qsort()
-static int int_cmp(const void *a, const void *b)
+static int int_cmp(const void *pa, const void *pb)
{
- return *(const int *)a - *(const int *)b;
+ const int a = *(const int *)pa;
+ const int b = *(const int *)pb;
+ if (a > b) {
+ return 1;
+ }
+ if (a < b) {
+ return -1;
+ }
+ return 0;
}
/// Handle setting 'colorcolumn' or 'textwidth' in window "wp".