]> granicus.if.org Git - vim/commitdiff
patch 8.2.0060: message test only runs with one encoding v8.2.0060
authorBram Moolenaar <Bram@vim.org>
Mon, 30 Dec 2019 16:55:34 +0000 (17:55 +0100)
committerBram Moolenaar <Bram@vim.org>
Mon, 30 Dec 2019 16:55:34 +0000 (17:55 +0100)
Problem:    Message test only runs with one encoding. (Dominique Pelle)
Solution:   Run the test with "utf-8" and "latin1".  Fix underflow. (related
            to #5410)

src/message.c
src/message_test.c
src/version.c

index 4040e5ba568d290a556e24feea69a86f6cae84b5..7a6e346096e4162e198ff3d1a87723234e995a6b 100644 (file)
@@ -307,7 +307,8 @@ trunc_string(
     }
     else
     {
-       for (i = (int)STRLEN(s); len + (n = ptr2cells(s + i - 1)) <= room; --i)
+       for (i = (int)STRLEN(s);
+                  i - 1 >= 0 && len + (n = ptr2cells(s + i - 1)) <= room; --i)
            len += n;
     }
 
index 6faad65fecff12a3dbbfd467a23fe66f0aec70fa..23650dd6bc74b3f34447c3e0f813bdbfc1ca73bc 100644 (file)
@@ -100,8 +100,14 @@ main(int argc, char **argv)
     params.argc = argc;
     params.argv = argv;
     common_init(&params);
+
+    set_option_value((char_u *)"encoding", 0, (char_u *)"utf-8", 0);
     init_chartab();
+    test_trunc_string();
 
+    set_option_value((char_u *)"encoding", 0, (char_u *)"latin1", 0);
+    init_chartab();
     test_trunc_string();
+
     return 0;
 }
index aeb1920b9f8a50f4e9c684ab505669499b4ef902..3a22ca41d8bafbf2df2f3918dc064f447d0b04ca 100644 (file)
@@ -742,6 +742,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    60,
 /**/
     59,
 /**/