To: vim_dev@googlegroups.com Subject: Patch 8.1.1105 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.1105 Problem: Long escape sequences may be split up. Solution: Assume esccape sequences can be up to 80 bytes long. (Nobuhiro Takasaki, closes #4196) Files: src/term.c *** ../vim-8.1.1104/src/term.c 2019-03-30 22:11:17.534968563 +0100 --- src/term.c 2019-04-03 20:43:35.324955447 +0200 *************** *** 2538,2549 **** } /* ! * the number of calls to ui_write is reduced by using the buffer "out_buf" */ #define OUT_SIZE 2047 ! /* Add one to allow mch_write() in os_win32.c to append a NUL */ static char_u out_buf[OUT_SIZE + 1]; ! static int out_pos = 0; /* number of chars in out_buf */ /* * out_flush(): flush the output buffer --- 2538,2555 ---- } /* ! * The number of calls to ui_write is reduced by using "out_buf". */ #define OUT_SIZE 2047 ! ! // add one to allow mch_write() in os_win32.c to append a NUL static char_u out_buf[OUT_SIZE + 1]; ! ! static int out_pos = 0; // number of chars in out_buf ! ! // Since the maximum number of SGR parameters shown as a normal value range is ! // 16, the escape sequence length can be 4 * 16 + lead + tail. ! #define MAX_ESC_SEQ_LEN 80 /* * out_flush(): flush the output buffer *************** *** 2660,2671 **** void out_str_nf(char_u *s) { ! if (out_pos > OUT_SIZE - 20) /* avoid terminal strings being split up */ out_flush(); while (*s) out_char_nf(*s++); ! /* For testing we write one string at a time. */ if (p_wd) out_flush(); } --- 2666,2679 ---- void out_str_nf(char_u *s) { ! // avoid terminal strings being split up ! if (out_pos > OUT_SIZE - MAX_ESC_SEQ_LEN) out_flush(); + while (*s) out_char_nf(*s++); ! // For testing we write one string at a time. if (p_wd) out_flush(); } *************** *** 2694,2700 **** return; } #endif ! if (out_pos > OUT_SIZE - 20) out_flush(); #ifdef HAVE_TGETENT for (p = s; *s; ++s) --- 2702,2708 ---- return; } #endif ! if (out_pos > OUT_SIZE - MAX_ESC_SEQ_LEN) out_flush(); #ifdef HAVE_TGETENT for (p = s; *s; ++s) *************** *** 2762,2768 **** } #endif /* avoid terminal strings being split up */ ! if (out_pos > OUT_SIZE - 20) out_flush(); #ifdef HAVE_TGETENT tputs((char *)s, 1, TPUTSFUNCAST out_char_nf); --- 2770,2776 ---- } #endif /* avoid terminal strings being split up */ ! if (out_pos > OUT_SIZE - MAX_ESC_SEQ_LEN) out_flush(); #ifdef HAVE_TGETENT tputs((char *)s, 1, TPUTSFUNCAST out_char_nf); *** ../vim-8.1.1104/src/version.c 2019-04-03 20:30:56.085017544 +0200 --- src/version.c 2019-04-03 20:38:21.846531027 +0200 *************** *** 773,774 **** --- 773,776 ---- { /* Add new patch number below this line */ + /**/ + 1105, /**/ -- hundred-and-one symptoms of being an internet addict: 187. You promise yourself that you'll only stay online for another 15 minutes...at least once every hour. /// Bram Moolenaar -- Bram@Moolenaar.net -- 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 ///