Skip to content

Commit d0337e3

Browse files
committed
patch 8.2.0060: message test only runs with one encoding
Problem: Message test only runs with one encoding. (Dominique Pelle) Solution: Run the test with "utf-8" and "latin1". Fix underflow. (related to #5410)
1 parent 85b0957 commit d0337e3

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/message.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,8 @@ trunc_string(
307307
}
308308
else
309309
{
310-
for (i = (int)STRLEN(s); len + (n = ptr2cells(s + i - 1)) <= room; --i)
310+
for (i = (int)STRLEN(s);
311+
i - 1 >= 0 && len + (n = ptr2cells(s + i - 1)) <= room; --i)
311312
len += n;
312313
}
313314

src/message_test.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,14 @@ main(int argc, char **argv)
100100
params.argc = argc;
101101
params.argv = argv;
102102
common_init(&params);
103+
104+
set_option_value((char_u *)"encoding", 0, (char_u *)"utf-8", 0);
103105
init_chartab();
106+
test_trunc_string();
104107

108+
set_option_value((char_u *)"encoding", 0, (char_u *)"latin1", 0);
109+
init_chartab();
105110
test_trunc_string();
111+
106112
return 0;
107113
}

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
60,
745747
/**/
746748
59,
747749
/**/

0 commit comments

Comments
 (0)