Patch 8.2.0801
Problem:    Terminal test fails on Mac.
Solution:   Concatenate OSC pieces.
Files:      src/terminal.c


*** ../vim-8.2.0800/src/terminal.c      2020-05-19 21:19:34.891367031 +0200
--- src/terminal.c      2020-05-19 23:09:34.206742847 +0200
***************
*** 162,167 ****
--- 162,168 ----
      char_u    *tl_cursor_color; // NULL or allocated
  
      int               tl_using_altscreen;
+     garray_T  tl_osc_buf;         // incomplete OSC string
  };
  
  #define TMODE_ONCE 1      // CTRL-\ CTRL-N used
***************
*** 445,450 ****
--- 446,452 ----
  #endif
      ga_init2(&term->tl_scrollback, sizeof(sb_line_T), 300);
      ga_init2(&term->tl_scrollback_postponed, sizeof(sb_line_T), 300);
+     ga_init2(&term->tl_osc_buf, sizeof(char), 300);
  
      CLEAR_FIELD(split_ea);
      if (opt->jo_curwin)
***************
*** 1015,1020 ****
--- 1017,1023 ----
        terminals_to_free = term->tl_next;
  
        free_scrollback(term);
+       ga_clear(&term->tl_osc_buf);
  
        term_free_vterm(term);
        vim_free(term->tl_api);
***************
*** 4202,4215 ****
      typval_T  tv;
      channel_T *channel = term->tl_job == NULL ? NULL
                                                    : term->tl_job->jv_channel;
  
      // We recognize only OSC 5 1 ; {command}
      if (command != 51)
        return 0;
  
!     reader.js_buf = vim_strnsave((char_u *)frag.str, (int)(frag.len));
!     if (reader.js_buf == NULL)
        return 1;
      reader.js_fill = NULL;
      reader.js_used = 0;
      if (json_decode(&reader, &tv, 0) == OK
--- 4205,4229 ----
      typval_T  tv;
      channel_T *channel = term->tl_job == NULL ? NULL
                                                    : term->tl_job->jv_channel;
+     garray_T  *gap = &term->tl_osc_buf;
  
      // We recognize only OSC 5 1 ; {command}
      if (command != 51)
        return 0;
  
!     // Concatenate what was received until the final piece is found.
!     if (ga_grow(gap, (int)frag.len + 1) == FAIL)
!     {
!       ga_clear(gap);
!       return 1;
!     }
!     mch_memmove((char *)gap->ga_data + gap->ga_len, frag.str, frag.len);
!     gap->ga_len += frag.len;
!     if (!frag.final)
        return 1;
+ 
+     ((char *)gap->ga_data)[gap->ga_len] = 0;
+     reader.js_buf = gap->ga_data;
      reader.js_fill = NULL;
      reader.js_used = 0;
      if (json_decode(&reader, &tv, 0) == OK
***************
*** 4243,4249 ****
      else
        ch_log(channel, "Invalid JSON received");
  
!     vim_free(reader.js_buf);
      clear_tv(&tv);
      return 1;
  }
--- 4257,4263 ----
      else
        ch_log(channel, "Invalid JSON received");
  
!     ga_clear(gap);
      clear_tv(&tv);
      return 1;
  }
*** ../vim-8.2.0800/src/version.c       2020-05-19 22:38:55.608777143 +0200
--- src/version.c       2020-05-19 23:00:25.072211269 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     801,
  /**/

-- 
I wish there was a knob on the TV to turn up the intelligence.
There's a knob called "brightness", but it doesn't seem to work. 

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005192111.04JLBXdj013784%40masaka.moolenaar.net.

Raspunde prin e-mail lui