Patch 7.4.1810
Problem:    Sending DETACH after a channel was closed isn't useful.
Solution:   Only add DETACH for a netbeans channel.
Files:      src/channel.c, src/testdir/test_channel.vim


*** ../vim-7.4.1809/src/channel.c       2016-04-30 16:07:18.607060334 +0200
--- src/channel.c       2016-04-30 17:01:18.239038627 +0200
***************
*** 2595,2601 ****
  #endif
  
  
! /* Sent when the channel is found closed when reading. */
  #define DETACH_MSG_RAW "DETACH\n"
  
  /* Buffer size for reading incoming messages. */
--- 2595,2601 ----
  #endif
  
  
! /* Sent when the netbeans channel is found closed when reading. */
  #define DETACH_MSG_RAW "DETACH\n"
  
  /* Buffer size for reading incoming messages. */
***************
*** 2766,2772 ****
  }
  
      static void
! channel_close_on_error(channel_T *channel, int part, char *func)
  {
      /* Do not call emsg(), most likely the other end just exited. */
      ch_errors(channel, "%s(): Cannot read from channel", func);
--- 2766,2772 ----
  }
  
      static void
! channel_close_on_error(channel_T *channel, char *func)
  {
      /* Do not call emsg(), most likely the other end just exited. */
      ch_errors(channel, "%s(): Cannot read from channel", func);
***************
*** 2780,2789 ****
       *                -> ui_breakcheck
       *                    -> gui event loop or select loop
       *                        -> channel_read()
!      * Don't send "DETACH" for a JS or JSON channel.
       */
!     if (channel->ch_part[part].ch_mode == MODE_RAW
!                            || channel->ch_part[part].ch_mode == MODE_NL)
        channel_save(channel, PART_OUT, (char_u *)DETACH_MSG_RAW,
                              (int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT ");
  
--- 2780,2788 ----
       *                -> ui_breakcheck
       *                    -> gui event loop or select loop
       *                        -> channel_read()
!      * Only send "DETACH" for a netbeans channel.
       */
!     if (channel->ch_nb_close_cb != NULL)
        channel_save(channel, PART_OUT, (char_u *)DETACH_MSG_RAW,
                              (int)STRLEN(DETACH_MSG_RAW), FALSE, "PUT ");
  
***************
*** 2847,2853 ****
  
      /* Reading a disconnection (readlen == 0), or an error. */
      if (readlen <= 0)
!       channel_close_on_error(channel, part, func);
  
  #if defined(CH_HAS_GUI) && defined(FEAT_GUI_GTK)
      /* signal the main loop that there is something to read */
--- 2846,2852 ----
  
      /* Reading a disconnection (readlen == 0), or an error. */
      if (readlen <= 0)
!       channel_close_on_error(channel, func);
  
  #if defined(CH_HAS_GUI) && defined(FEAT_GUI_GTK)
      /* signal the main loop that there is something to read */
***************
*** 3119,3126 ****
                if (r == CW_READY)
                    channel_read(channel, part, "channel_handle_events");
                else if (r == CW_ERROR)
!                   channel_close_on_error(channel, part,
!                                                  "channel_handle_events()");
            }
        }
      }
--- 3118,3124 ----
                if (r == CW_READY)
                    channel_read(channel, part, "channel_handle_events");
                else if (r == CW_ERROR)
!                   channel_close_on_error(channel, "channel_handle_events()");
            }
        }
      }
*** ../vim-7.4.1809/src/testdir/test_channel.vim        2016-04-30 
16:07:18.607060334 +0200
--- src/testdir/test_channel.vim        2016-04-30 17:05:15.808377478 +0200
***************
*** 1056,1068 ****
  
    let s:counter = 1
    let s:msg1 = ''
-   let s:msg2 = ''
    let s:closemsg = 0
    func! OutHandler(chan, msg)
      if s:counter == 1
        let s:msg1 = a:msg
-     else
-       let s:msg2 = a:msg
      endif
      let s:counter += 1
    endfunc
--- 1056,1065 ----
***************
*** 1075,1084 ****
        \ 'close_cb': 'CloseHandler'})
    call assert_equal("run", job_status(job))
    try
!     call s:waitFor('s:closemsg != 0 && s:msg2 != ""')
      call assert_equal('quit', s:msg1)
!     call assert_equal('DETACH', s:msg2)
!     call assert_equal(3, s:closemsg)
    finally
      call job_stop(job)
      delfunc OutHandler
--- 1072,1080 ----
        \ 'close_cb': 'CloseHandler'})
    call assert_equal("run", job_status(job))
    try
!     call s:waitFor('s:closemsg != 0 && s:msg1 != ""')
      call assert_equal('quit', s:msg1)
!     call assert_equal(2, s:closemsg)
    finally
      call job_stop(job)
      delfunc OutHandler
*** ../vim-7.4.1809/src/version.c       2016-04-30 16:49:45.598789137 +0200
--- src/version.c       2016-04-30 17:00:49.555359838 +0200
***************
*** 755,756 ****
--- 755,758 ----
  {   /* Add new patch number below this line */
+ /**/
+     1810,
  /**/

-- 
BEDEVERE: How do you know so much about swallows?
ARTHUR:   Well you have to know these things when you're a king, you know.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

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