patch 8.2.5056: the channel log only contains some of the raw terminal output
Problem: The channel log only contains some of the raw terminal output.
Solution: Add the "o" flag to log all terminal output. Use it for "--log".
diff --git a/src/channel.c b/src/channel.c
index e3b32ee..abd2ce1 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -152,7 +152,8 @@
void
ch_logfile(char_u *fname, char_u *opt)
{
- FILE *file = NULL;
+ FILE *file = NULL;
+ char *mode = "a";
if (log_fd != NULL)
{
@@ -163,9 +164,14 @@
fclose(log_fd);
}
+ // The "a" flag overrules the "w" flag.
+ if (vim_strchr(opt, 'a') == NULL && vim_strchr(opt, 'w') != NULL)
+ mode = "w";
+ ch_log_output = vim_strchr(opt, 'o') != NULL ? LOG_ALWAYS : FALSE;
+
if (*fname != NUL)
{
- file = fopen((char *)fname, *opt == 'w' ? "w" : "a");
+ file = fopen((char *)fname, mode);
if (file == NULL)
{
semsg(_(e_cant_open_file_str), fname);