Patch 8.0.0764
Problem:    'termkey' does not work yet.
Solution:   Implement 'termkey'.
Files:      src/terminal.c, src/option.c, src/proto/option.pro


*** ../vim-8.0.0763/src/terminal.c      2017-07-23 19:50:39.028922806 +0200
--- src/terminal.c      2017-07-23 22:44:12.437931293 +0200
***************
*** 60,68 ****
   * - implement term_scrape(buf, row)          inspect terminal screen
   * - implement term_open(command, options)    open terminal window
   * - implement term_getjob(buf)
-  * - implement 'termkey'
   * - when 'encoding' is not utf-8, or the job is using another encoding, setup
   *   conversions.
   */
  
  #include "vim.h"
--- 60,68 ----
   * - implement term_scrape(buf, row)          inspect terminal screen
   * - implement term_open(command, options)    open terminal window
   * - implement term_getjob(buf)
   * - when 'encoding' is not utf-8, or the job is using another encoding, setup
   *   conversions.
+  * - In the GUI use a terminal emulator for :!cmd.
   */
  
  #include "vim.h"
***************
*** 445,450 ****
--- 445,454 ----
      size_t    len;
      static int        mouse_was_outside = FALSE;
      int               dragging_outside = FALSE;
+     int               termkey = 0;
+ 
+     if (*curwin->w_p_tk != NUL)
+       termkey = string_to_key(curwin->w_p_tk, TRUE);
  
      for (;;)
      {
***************
*** 459,468 ****
        --no_mapping;
        --allow_keys;
  
        /* Catch keys that need to be handled as in Normal mode. */
        switch (c)
        {
-           case Ctrl_W:
            case NUL:
            case K_ZERO:
                stuffcharReadbuff(c);
--- 463,477 ----
        --no_mapping;
        --allow_keys;
  
+       if (c == (termkey == 0 ? Ctrl_W : termkey))
+       {
+           stuffcharReadbuff(Ctrl_W);
+           return;
+       }
+ 
        /* Catch keys that need to be handled as in Normal mode. */
        switch (c)
        {
            case NUL:
            case K_ZERO:
                stuffcharReadbuff(c);
*** ../vim-8.0.0763/src/option.c        2017-07-23 19:50:39.028922806 +0200
--- src/option.c        2017-07-23 22:44:23.125855915 +0200
***************
*** 3269,3275 ****
  static char_u *term_bg_default(void);
  static void did_set_option(int opt_idx, int opt_flags, int new_value);
  static char_u *illegal_char(char_u *, int);
- static int string_to_key(char_u *arg);
  #ifdef FEAT_CMDWIN
  static char_u *check_cedit(void);
  #endif
--- 3269,3274 ----
***************
*** 4763,4769 ****
                                        && (!arg[1] || VIM_ISWHITE(arg[1]))
                                        && !VIM_ISDIGIT(*arg))))
                        {
!                           value = string_to_key(arg);
                            if (value == 0 && (long *)varp != &p_wcm)
                            {
                                errmsg = e_invarg;
--- 4762,4768 ----
                                        && (!arg[1] || VIM_ISWHITE(arg[1]))
                                        && !VIM_ISDIGIT(*arg))))
                        {
!                           value = string_to_key(arg, FALSE);
                            if (value == 0 && (long *)varp != &p_wcm)
                            {
                                errmsg = e_invarg;
***************
*** 5320,5333 ****
  /*
   * Convert a key name or string into a key value.
   * Used for 'wildchar' and 'cedit' options.
   */
!     static int
! string_to_key(char_u *arg)
  {
      if (*arg == '<')
        return find_key_option(arg + 1);
      if (*arg == '^')
        return Ctrl_chr(arg[1]);
      return *arg;
  }
  
--- 5319,5335 ----
  /*
   * Convert a key name or string into a key value.
   * Used for 'wildchar' and 'cedit' options.
+  * When "multi_byte" is TRUE allow for multi-byte characters.
   */
!     int
! string_to_key(char_u *arg, int multi_byte)
  {
      if (*arg == '<')
        return find_key_option(arg + 1);
      if (*arg == '^')
        return Ctrl_chr(arg[1]);
+     if (multi_byte)
+       return PTR2CHAR(arg);
      return *arg;
  }
  
***************
*** 5345,5351 ****
        cedit_key = -1;
      else
      {
!       n = string_to_key(p_cedit);
        if (vim_isprintc(n))
            return e_invarg;
        cedit_key = n;
--- 5347,5353 ----
        cedit_key = -1;
      else
      {
!       n = string_to_key(p_cedit, FALSE);
        if (vim_isprintc(n))
            return e_invarg;
        cedit_key = n;
***************
*** 7462,7467 ****
--- 7464,7475 ----
  #endif
  
  #ifdef FEAT_TERMINAL
+     /* 'termkey' */
+     else if (varp == &curwin->w_p_tms)
+     {
+       if (*curwin->w_p_tk != NUL && string_to_key(curwin->w_p_tk, TRUE) == 0)
+           errmsg = e_invarg;
+     }
      /* 'termsize' */
      else if (varp == &curwin->w_p_tms)
      {
*** ../vim-8.0.0763/src/proto/option.pro        2016-09-12 13:04:15.000000000 
+0200
--- src/proto/option.pro        2017-07-23 22:35:24.581640906 +0200
***************
*** 9,14 ****
--- 9,15 ----
  void init_gui_options(void);
  void set_title_defaults(void);
  int do_set(char_u *arg, int opt_flags);
+ int string_to_key(char_u *arg, int multi_byte);
  void set_options_bin(int oldval, int newval, int opt_flags);
  int get_viminfo_parameter(int type);
  char_u *find_viminfo_parameter(int type);
*** ../vim-8.0.0763/src/version.c       2017-07-23 22:07:23.045277125 +0200
--- src/version.c       2017-07-23 22:49:36.815647324 +0200
***************
*** 771,772 ****
--- 771,774 ----
  {   /* Add new patch number below this line */
+ /**/
+     764,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
224. You set up your own Web page. You set up a Web page for each
     of your kids... and your pets.

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