Rich Howe wrote:

> Usually, :q command will show a warning
> E37: No write since last change (add ! to override)
> and will not quit the window if the buffer is being changed.
> 
> However, the current buffer has been splitted into 2 or more windows
> and use :{count}q command to a window of other buffers,
> that window is quitted without warning and any changes is lost.
> 
> This happens on 8.0.2 and 8.0.1203.
> 
> I am not exactly sure but the following change in ex_docmd.c may fix
> the problem.  Looks like the current buffer is to be quitted as of
> 8.0.1203.

Can you give reproduction steps?  I tried this:

        vim foo
        [add some text]
        split bar
        [add some text]
        :1q
        Get E37
        :2q
        Get E37

> 
> --- ex_docmdX.c       2017-10-16 18:16:44.114732500 +0900
> +++ ex_docmd.c        2017-10-16 18:46:28.990821600 +0900
> @@ -7224,10 +7224,10 @@
>       wp = curwin;
>  
>  #ifdef FEAT_AUTOCMD
> -    apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, curbuf);
> +    apply_autocmds(EVENT_QUITPRE, NULL, NULL, FALSE, wp->w_buffer);

That's a separate issue, I'll make a test for that.

>      /* Refuse to quit when locked or when the buffer in the last window is
>       * being closed (can only happen in autocommands). */
> -    if (curbuf_locked() || !win_valid(wp)
> +    if (!win_valid(wp)
>           || (wp->w_buffer->b_nwindows == 1 && wp->w_buffer->b_locked > 0))
>       return;

This was correct, but curbuf_locked() should be called before
apply_autocmds().

>  #endif
> @@ -7241,8 +7241,8 @@
>       */
>      if (check_more(FALSE, eap->forceit) == OK && only_one_window())
>       exiting = TRUE;
> -    if ((!buf_hide(curbuf)
> -             && check_changed(curbuf, (p_awa ? CCGD_AW : 0)
> +    if ((!buf_hide(wp->w_buffer)
> +             && check_changed(wp->w_buffer, (p_awa ? CCGD_AW : 0)
>                                      | (eap->forceit ? CCGD_FORCEIT : 0)
>                                      | CCGD_EXCMD))
>           || check_more(TRUE, eap->forceit) == FAIL

Should have a test for this change.

-- 
You know you use Vim too much when you have this alias in your
~/.bashrc file: alias :e=/bin/vim             (Eljay Love-Jensen)

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