Patch 8.1.1870
Problem:    Using :pedit from a help file sets the preview window to help
            filetype. (Wang Shidong)
Solution:   Do not set "keep_help_flag". (closes #3536)
Files:      src/ex_docmd.c, src/testdir/test_window_cmd.vim


*** ../vim-8.1.1869/src/ex_docmd.c      2019-08-17 14:38:35.647786228 +0200
--- src/ex_docmd.c      2019-08-17 15:06:59.499335060 +0200
***************
*** 8612,8627 ****
  {
      win_T     *curwin_save = curwin;
  
      g_do_tagpreview = p_pvh;
      prepare_tagpreview(TRUE);
  
!     keep_help_flag = bt_help(curwin_save->w_buffer);
      do_exedit(eap, NULL);
-     keep_help_flag = FALSE;
  
      if (curwin != curwin_save && win_valid(curwin_save))
      {
!       /* Return cursor to where we were */
        validate_cursor();
        redraw_later(VALID);
        win_enter(curwin_save, TRUE);
--- 8612,8627 ----
  {
      win_T     *curwin_save = curwin;
  
+     // Open the preview window or popup and make it the current window.
      g_do_tagpreview = p_pvh;
      prepare_tagpreview(TRUE);
  
!     // Edit the file.
      do_exedit(eap, NULL);
  
      if (curwin != curwin_save && win_valid(curwin_save))
      {
!       // Return cursor to where we were
        validate_cursor();
        redraw_later(VALID);
        win_enter(curwin_save, TRUE);
*** ../vim-8.1.1869/src/testdir/test_window_cmd.vim     2019-07-27 
17:31:33.028355333 +0200
--- src/testdir/test_window_cmd.vim     2019-08-17 15:06:25.203502887 +0200
***************
*** 190,195 ****
--- 190,210 ----
    call assert_fails('wincmd P', 'E441:')
  endfunc
  
+ func Test_window_preview_from_help()
+   filetype on
+   call writefile(['/* some C code */'], 'Xpreview.c')
+   help
+   pedit Xpreview.c
+   wincmd P
+   call assert_equal(1, &previewwindow)
+   call assert_equal('c', &filetype)
+   wincmd z
+ 
+   filetype off
+   close
+   call delete('Xpreview.c')
+ endfunc
+ 
  func Test_window_exchange()
    e Xa
  
***************
*** 582,587 ****
--- 597,603 ----
  endfunc
  
  func Fun_RenewFile()
+   " Need to wait a bit for the timestamp to be older.
    sleep 2
    silent execute '!echo "1" > tmp.txt'
    sp
***************
*** 599,605 ****
    call writefile(['2'], 'tmp.txt')
    new tmp.txt
    q
-   " Need to wait a bit for the timestamp to be older.
    call Fun_RenewFile()
    call assert_equal(2, winnr())
    wincmd p
--- 615,620 ----
*** ../vim-8.1.1869/src/version.c       2019-08-17 14:38:35.647786228 +0200
--- src/version.c       2019-08-17 14:54:27.291027461 +0200
***************
*** 771,772 ****
--- 771,774 ----
  {   /* Add new patch number below this line */
+ /**/
+     1870,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
80. At parties, you introduce your spouse as your "service provider."

 /// 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/201908171308.x7HD8T4V007559%40masaka.moolenaar.net.

Raspunde prin e-mail lui