Patch 8.2.0816
Problem:    Terminal test fails when compiled with Athena.
Solution:   Do give an error when the GUI is not running. (hint by Dominique
            Pelle, closes #5928, closes #6132)
Files:      src/globals.h, src/gui.c, src/term.c, src/channel.c,
            src/testdir/test_terminal.vim


*** ../vim-8.2.0815/src/globals.h       2020-05-17 14:06:07.317201551 +0200
--- src/globals.h       2020-05-24 16:55:49.047925225 +0200
***************
*** 1767,1772 ****
--- 1767,1775 ----
  
  EXTERN char e_lock_unlock[]   INIT(= N_("E940: Cannot lock or unlock variable 
%s"));
  #endif
+ #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
+ EXTERN char e_alloc_color[]   INIT(= N_("E254: Cannot allocate color %s"));
+ #endif
  
  #ifdef FEAT_GUI_MAC
  EXTERN short disallow_gui     INIT(= FALSE);
*** ../vim-8.2.0815/src/gui.c   2020-04-30 22:50:55.605076816 +0200
--- src/gui.c   2020-05-24 16:57:43.003590210 +0200
***************
*** 4741,4747 ****
            && gui.in_use
  #endif
            )
!       semsg(_("E254: Cannot allocate color %s"), name);
      return t;
  }
  
--- 4741,4747 ----
            && gui.in_use
  #endif
            )
!       semsg(_(e_alloc_color), name);
      return t;
  }
  
*** ../vim-8.2.0815/src/term.c  2020-05-21 20:10:00.281336782 +0200
--- src/term.c  2020-05-24 16:57:21.343653924 +0200
***************
*** 1381,1387 ****
      t = termgui_mch_get_color(name);
  
      if (t == INVALCOLOR)
!       semsg(_("E254: Cannot allocate color %s"), name);
      return t;
  }
  
--- 1381,1387 ----
      t = termgui_mch_get_color(name);
  
      if (t == INVALCOLOR)
!       semsg(_(e_alloc_color), name);
      return t;
  }
  
***************
*** 1587,1595 ****
  
            log_tr("Received t_Co, redraw_asap(): %d", r);
        }
! #else
        redraw_asap(CLEAR);
! #endif
      }
  }
  #endif
--- 1587,1595 ----
  
            log_tr("Received t_Co, redraw_asap(): %d", r);
        }
! # else
        redraw_asap(CLEAR);
! # endif
      }
  }
  #endif
***************
*** 1597,1606 ****
  #ifdef HAVE_TGETENT
  static char *(key_names[]) =
  {
! #ifdef FEAT_TERMRESPONSE
      // Do this one first, it may cause a screen redraw.
      "Co",
! #endif
      "ku", "kd", "kr", "kl",
      "#2", "#4", "%i", "*7",
      "k1", "k2", "k3", "k4", "k5", "k6",
--- 1597,1606 ----
  #ifdef HAVE_TGETENT
  static char *(key_names[]) =
  {
! # ifdef FEAT_TERMRESPONSE
      // Do this one first, it may cause a screen redraw.
      "Co",
! # endif
      "ku", "kd", "kr", "kl",
      "#2", "#4", "%i", "*7",
      "k1", "k2", "k3", "k4", "k5", "k6",
*** ../vim-8.2.0815/src/channel.c       2020-05-13 22:44:18.138288820 +0200
--- src/channel.c       2020-05-24 16:59:01.819358123 +0200
***************
*** 5308,5313 ****
--- 5306,5312 ----
                {
                    char_u      *color_name;
                    guicolor_T  guicolor;
+                   int         called_emsg_before = called_emsg;
  
                    color_name = tv_get_string_chk(&li->li_tv);
                    if (color_name == NULL)
***************
*** 5315,5321 ****
--- 5314,5325 ----
  
                    guicolor = GUI_GET_COLOR(color_name);
                    if (guicolor == INVALCOLOR)
+                   {
+                       if (called_emsg_before == called_emsg)
+                           // may not get the error if the GUI didn't start
+                           semsg(_(e_alloc_color), color_name);
                        return FAIL;
+                   }
  
                    rgb[n] = GUI_MCH_GET_RGB(guicolor);
                }
*** ../vim-8.2.0815/src/testdir/test_terminal.vim       2020-05-22 
14:44:23.301661908 +0200
--- src/testdir/test_terminal.vim       2020-05-24 17:16:57.171529626 +0200
***************
*** 1009,1021 ****
    call assert_fails(cmd, 'E475:')
    let cmd = "call term_start('', {'term_highlight' : []})"
    call assert_fails(cmd, 'E475:')
!   if has('gui')
      let cmd = "call term_start('', {'ansi_colors' : 'abc'})"
      call assert_fails(cmd, 'E475:')
      let cmd = "call term_start('', {'ansi_colors' : [[]]})"
      call assert_fails(cmd, 'E730:')
      let cmd = "call term_start('', {'ansi_colors' : repeat(['blue'], 18)})"
!     call assert_fails(cmd, 'E475:')
    endif
  endfunc
  
--- 1009,1025 ----
    call assert_fails(cmd, 'E475:')
    let cmd = "call term_start('', {'term_highlight' : []})"
    call assert_fails(cmd, 'E475:')
!   if has('gui') || has('termguicolors')
      let cmd = "call term_start('', {'ansi_colors' : 'abc'})"
      call assert_fails(cmd, 'E475:')
      let cmd = "call term_start('', {'ansi_colors' : [[]]})"
      call assert_fails(cmd, 'E730:')
      let cmd = "call term_start('', {'ansi_colors' : repeat(['blue'], 18)})"
!     if has('gui_running') || has('termguicolors')
!       call assert_fails(cmd, 'E475:')
!     else
!       call assert_fails(cmd, 'E254:')
!     endif
    endif
  endfunc
  
***************
*** 2668,2674 ****
  " Test for passing invalid arguments to terminal functions
  func Test_term_func_invalid_arg()
    call assert_fails('let b = term_getaltscreen([])', 'E745:')
-   call assert_fails('let p = term_getansicolors([])', 'E745:')
    call assert_fails('let a = term_getattr(1, [])', 'E730:')
    call assert_fails('let c = term_getcursor([])', 'E745:')
    call assert_fails('let l = term_getline([], 1)', 'E745:')
--- 2672,2677 ----
***************
*** 2677,2686 ****
    call assert_fails('let s = term_getstatus([])', 'E745:')
    call assert_fails('let s = term_scrape([], 1)', 'E745:')
    call assert_fails('call term_sendkeys([], "a")', 'E745:')
-   call assert_fails('call term_setansicolors([], [])', 'E745:')
    call assert_fails('call term_setapi([], "")', 'E745:')
    call assert_fails('call term_setrestore([], "")', 'E745:')
    call assert_fails('call term_setkill([], "")', 'E745:')
  endfunc
  
  " Test for sending various special keycodes to a terminal
--- 2680,2692 ----
    call assert_fails('let s = term_getstatus([])', 'E745:')
    call assert_fails('let s = term_scrape([], 1)', 'E745:')
    call assert_fails('call term_sendkeys([], "a")', 'E745:')
    call assert_fails('call term_setapi([], "")', 'E745:')
    call assert_fails('call term_setrestore([], "")', 'E745:')
    call assert_fails('call term_setkill([], "")', 'E745:')
+   if has('gui') || has('termguicolors')
+     call assert_fails('let p = term_getansicolors([])', 'E745:')
+     call assert_fails('call term_setansicolors([], [])', 'E745:')
+   endif
  endfunc
  
  " Test for sending various special keycodes to a terminal
*** ../vim-8.2.0815/src/version.c       2020-05-24 13:10:14.303617017 +0200
--- src/version.c       2020-05-24 17:01:37.302899660 +0200
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     816,
  /**/

-- 
        Very funny, Scotty.  Now beam down my clothes.

 /// 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/202005241524.04OFODhh056519%40masaka.moolenaar.net.

Raspunde prin e-mail lui