aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorMichael Ennen <mike.ennen@gmail.com>2015-12-30 23:42:38 -0700
committerJustin M. Keyes <justinkz@gmail.com>2016-01-13 03:23:19 -0500
commit5c87d40acdd02286baf492067031c93d93b7d389 (patch)
tree736cdbff1acdc990d23b4d3bd7787c02fa02bfb3 /src/nvim/ex_cmds.c
parent8bfb521417ef4910ff977ae9e97b2b37c9a4605f (diff)
downloadrneovim-5c87d40acdd02286baf492067031c93d93b7d389.tar.gz
rneovim-5c87d40acdd02286baf492067031c93d93b7d389.tar.bz2
rneovim-5c87d40acdd02286baf492067031c93d93b7d389.zip
vim patches 7.4.955/974/975/989. #3919
Helped by @Shougo. vim-patch:7.4.955 vim-patch:7.4.974 vim-patch:7.4.975 vim-patch:7.4.989 Port upstream vim patches 955, 974, 975 and 989. Mark patches 964, 968, 970, and 971, and 982 as NA. Update patch list to 1022. patch 7.4.955 Problem: Vim doesn't recognize .pl6 and .pod6 files. Solution: Recognize them as perl6 and pod6. (Mike Eve) patch 7.4.974 Problem: When using :diffsplit the cursor jumps to the first line. Solution: Put the cursor on the line related to where the cursor was before the split. patch 7.4.975 Problem: Using ":sort" on a very big file sometimes causes text to be corrupted. (John Beckett) Solution: Copy the line into a buffer before calling ml_append(). patch 7.4.989 Problem: Leaking memory when hash_add() fails. Coverity error 99126. Solution: When hash_add() fails free the memory. 778 marked as not NA as it will be needed once vim patch 754 is merged Marked as NA: 964 test 87 was deleted 968 tests 86/87 were deleted 970 guarded by: `# if defined(FEAT_GUI_GTK) || defined(PROTO` and is inside a function that no longer exists 971 function table already sorted correctly 982 marked as NA because Neovim tests are only specified in exactly one location
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 29cff5a2b2..b1ae6520b1 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -495,10 +495,12 @@ void ex_sort(exarg_T *eap)
s = ml_get(nrs[eap->forceit ? count - i - 1 : i].lnum);
if (!unique || i == 0
|| (sort_ic ? STRICMP(s, sortbuf1) : STRCMP(s, sortbuf1)) != 0) {
- if (ml_append(lnum++, s, (colnr_T)0, FALSE) == FAIL)
+ // Copy the line into a buffer, it may become invalid in
+ // ml_append(). And it's needed for "unique".
+ STRCPY(sortbuf1, s);
+ if (ml_append(lnum++, sortbuf1, (colnr_T)0, false) == FAIL) {
break;
- if (unique)
- STRCPY(sortbuf1, s);
+ }
}
fast_breakcheck();
if (got_int)