Patch 8.0.1096
Problem:    Terminal window in Normal mode has wrong background.
Solution:   Store the default background and use it for clearning until the
            end of the line.  Not for below the last line, since there is no
            text there.
Files:      src/screen.c, src/terminal.c


*** ../vim-8.0.1095/src/screen.c        2017-09-02 20:30:31.167315016 +0200
--- src/screen.c        2017-09-11 21:55:11.318397038 +0200
***************
*** 3139,3144 ****
--- 3139,3145 ----
  #endif
  #ifdef FEAT_TERMINAL
      int               get_term_attr = FALSE;
+     int               term_attr = 0;          /* background for terminal 
window */
  #endif
  
      /* draw_state: items that are drawn in sequence: */
***************
*** 3256,3261 ****
--- 3257,3263 ----
      {
        extra_check = TRUE;
        get_term_attr = TRUE;
+       term_attr = term_get_attr(wp->w_buffer, 0, 0);
      }
  #endif
  
***************
*** 5057,5062 ****
--- 5059,5067 ----
  # ifdef FEAT_DIFF
                            diff_hlf != (hlf_T)0 ||
  # endif
+ # ifdef FEAT_TERMINAL
+                           term_attr != 0 ||
+ # endif
                            line_attr != 0
                        ) && (
  # ifdef FEAT_RIGHTLEFT
***************
*** 5091,5096 ****
--- 5096,5110 ----
                        }
                    }
  # endif
+ # ifdef FEAT_TERMINAL
+                   if (term_attr != 0)
+                   {
+                       char_attr = term_attr;
+                       if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
+                           char_attr = hl_combine_attr(char_attr,
+                                                           HL_ATTR(HLF_CUL));
+                   }
+ # endif
                }
  #endif
            }
*** ../vim-8.0.1095/src/terminal.c      2017-09-10 14:25:41.737419026 +0200
--- src/terminal.c      2017-09-11 21:59:25.444883481 +0200
***************
*** 39,47 ****
   *
   * TODO:
   * - patch to use GUI or cterm colors for vterm. Yasuhiro, #2067
-  * - when Normal background is not white or black, going to Terminal-Normal
-  *   mode does not clear correctly.  Use the terminal background color to 
erase
-  *   the background.
   * - patch to add tmap, jakalope (Jacob Askeland) #2073
   * - Redirecting output does not work on MS-Windows.
   * - implement term_setsize()
--- 39,44 ----
***************
*** 130,135 ****
--- 127,133 ----
  
      garray_T  tl_scrollback;
      int               tl_scrollback_scrolled;
+     cellattr_T        tl_default_color;
  
      VTermPos  tl_cursor_pos;
      int               tl_cursor_visible;
***************
*** 2321,2326 ****
--- 2319,2325 ----
  
  /*
   * Get the screen attribute for a position in the buffer.
+  * Use a zero "lnum" to get the default background color.
   */
      int
  term_get_attr(buf_T *buf, linenr_T lnum, int col)
***************
*** 2329,2340 ****
      sb_line_T *line;
      cellattr_T        *cellattr;
  
!     if (lnum > term->tl_scrollback.ga_len)
!       return 0;
!     line = (sb_line_T *)term->tl_scrollback.ga_data + lnum - 1;
!     if (col >= line->sb_cols)
!       return 0;
!     cellattr = line->sb_cells + col;
      return cell2attr(cellattr->attrs, cellattr->fg, cellattr->bg);
  }
  
--- 2328,2343 ----
      sb_line_T *line;
      cellattr_T        *cellattr;
  
!     if (lnum == 0 || lnum > term->tl_scrollback.ga_len)
!       cellattr = &term->tl_default_color;
!     else
!     {
!       line = (sb_line_T *)term->tl_scrollback.ga_data + lnum - 1;
!       if (col >= line->sb_cols)
!           cellattr = &term->tl_default_color;
!       else
!           cellattr = line->sb_cells + col;
!     }
      return cell2attr(cellattr->attrs, cellattr->fg, cellattr->bg);
  }
  
***************
*** 2347,2352 ****
--- 2350,2357 ----
      VTerm         *vterm;
      VTermScreen           *screen;
      VTermValue            value;
+     VTermColor            *fg, *bg;
+     int                   fgval, bgval;
  
      vterm = vterm_new(rows, cols);
      term->tl_vterm = vterm;
***************
*** 2357,2370 ****
  
      /* Vterm uses a default black background.  Set it to white when
       * 'background' is "light". */
      if (*p_bg == 'l')
      {
!       VTermColor      fg, bg;
! 
!       fg.red = fg.green = fg.blue = 0;
!       bg.red = bg.green = bg.blue = 255;
!       vterm_state_set_default_colors(vterm_obtain_state(vterm), &fg, &bg);
      }
  
      /* Required to initialize most things. */
      vterm_screen_reset(screen, 1 /* hard */);
--- 2362,2384 ----
  
      /* Vterm uses a default black background.  Set it to white when
       * 'background' is "light". */
+     vim_memset(&term->tl_default_color.attrs, 0, 
sizeof(VTermScreenCellAttrs));
+     term->tl_default_color.width = 1;
+     fg = &term->tl_default_color.fg;
+     bg = &term->tl_default_color.bg;
      if (*p_bg == 'l')
      {
!       fgval = 0;
!       bgval = 255;
!     }
!     else
!     {
!       fgval = 255;
!       bgval = 0;
      }
+     fg->red = fg->green = fg->blue = fgval;
+     bg->red = bg->green = bg->blue = bgval;
+     vterm_state_set_default_colors(vterm_obtain_state(vterm), fg, bg);
  
      /* Required to initialize most things. */
      vterm_screen_reset(screen, 1 /* hard */);
*** ../vim-8.0.1095/src/version.c       2017-09-11 20:45:19.795234470 +0200
--- src/version.c       2017-09-11 21:59:07.112991938 +0200
***************
*** 771,772 ****
--- 771,774 ----
  {   /* Add new patch number below this line */
+ /**/
+     1096,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
102. When filling out your driver's license application, you give
     your IP address.

 /// 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.

Raspunde prin e-mail lui