Patch 8.0.0800
Problem: Terminal window scrollback contents is wrong.
Solution: Fix handling of multi-byte characters (Yasuhiro Matsumoto) Handle
empty lines correctly. (closes #1891)
Files: src/terminal.c
*** ../vim-8.0.0799/src/terminal.c 2017-07-28 23:16:09.700193710 +0200
--- src/terminal.c 2017-07-29 14:51:17.327509436 +0200
***************
*** 765,790 ****
/* TODO: put the text in the buffer. */
if (ga_grow(&term->tl_scrollback, 1) == OK)
{
! VTermScreenCell *p;
! int len;
! int i;
/* do not store empty cells at the end */
for (i = 0; i < cols; ++i)
if (cells[i].chars[0] != 0)
len = i + 1;
! p = (VTermScreenCell *)alloc((int)sizeof(VTermScreenCell) * len);
if (p != NULL)
- {
- sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data
- + term->tl_scrollback.ga_len;
-
mch_memmove(p, cells, sizeof(VTermScreenCell) * len);
! line->sb_cols = len;
! line->sb_cells = p;
! ++term->tl_scrollback.ga_len;
! }
}
return 0; /* ignored */
}
--- 765,790 ----
/* TODO: put the text in the buffer. */
if (ga_grow(&term->tl_scrollback, 1) == OK)
{
! VTermScreenCell *p = NULL;
! int len = 0;
! int i;
! sb_line_T *line;
/* do not store empty cells at the end */
for (i = 0; i < cols; ++i)
if (cells[i].chars[0] != 0)
len = i + 1;
! if (len > 0)
! p = (VTermScreenCell *)alloc((int)sizeof(VTermScreenCell) * len);
if (p != NULL)
mch_memmove(p, cells, sizeof(VTermScreenCell) * len);
!
! line = (sb_line_T *)term->tl_scrollback.ga_data
! + term->tl_scrollback.ga_len;
! line->sb_cols = len;
! line->sb_cells = p;
! ++term->tl_scrollback.ga_len;
}
return 0; /* ignored */
}
***************
*** 818,824 ****
&& cell.chars[0] != NUL)
len = pos.col + 1;
! if (len > 0)
{
while (lines_skipped > 0)
{
--- 818,826 ----
&& cell.chars[0] != NUL)
len = pos.col + 1;
! if (len == 0)
! ++lines_skipped;
! else
{
while (lines_skipped > 0)
{
***************
*** 865,877 ****
ga.ga_len = 0;
for (col = 0; col < line->sb_cols; ++col)
! for (i = 0; (c = line->sb_cells[col].chars[i]) != 0 || i == 0; ++i)
! {
! if (ga_grow(&ga, MB_MAXBYTES) == FAIL)
! goto failed;
ga.ga_len += mb_char2bytes(c == NUL ? ' ' : c,
(char_u *)ga.ga_data + ga.ga_len);
! }
*((char_u *)ga.ga_data + ga.ga_len) = NUL;
ml_append_buf(term->tl_buffer, lnum, ga.ga_data, ga.ga_len + 1, FALSE);
}
--- 867,881 ----
ga.ga_len = 0;
for (col = 0; col < line->sb_cols; ++col)
! {
! if (ga_grow(&ga, MB_MAXBYTES) == FAIL)
! goto failed;
! for (i = 0; (c = line->sb_cells[col].chars[i]) > 0 || i == 0; ++i)
ga.ga_len += mb_char2bytes(c == NUL ? ' ' : c,
(char_u *)ga.ga_data + ga.ga_len);
! }
! if (ga_grow(&ga, 1) == FAIL)
! goto failed;
*((char_u *)ga.ga_data + ga.ga_len) = NUL;
ml_append_buf(term->tl_buffer, lnum, ga.ga_data, ga.ga_len + 1, FALSE);
}
*** ../vim-8.0.0799/src/version.c 2017-07-28 23:16:09.704193683 +0200
--- src/version.c 2017-07-29 14:08:11.053445296 +0200
***************
*** 771,772 ****
--- 771,774 ----
{ /* Add new patch number below this line */
+ /**/
+ 800,
/**/
--
Facepalm reply #9: "Speed up, you can drive 80 here" "Why, the cars behind us
are also driving 60"
/// 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].
For more options, visit https://groups.google.com/d/optout.