Problem: blob2str() does not restore trailing newline
Solution: Append empty string (thinca).
closes: #19288
Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
break;
}
+ // If the blob ends with a newline, we need to add another empty string.
+ if (blen > 0 && blob_get(blob, blen - 1) == NL)
+ list_append_string(rettv->vval.v_list, (char_u *)"", 0);
+
done:
vim_free(from_encoding);
}
call assert_equal(["ab"], blob2str(0z6162))
call assert_equal(["a\nb"], blob2str(0z610062))
call assert_equal(["ab", "cd"], blob2str(0z61620A6364))
+ call assert_equal(["ab", "cd", ""], blob2str(0z61620A63640A))
call assert_equal(["«»"], blob2str(0zC2ABC2BB))
call assert_equal(["ŝş"], blob2str(0zC59DC59F))
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2120,
/**/
2119,
/**/