New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

編集中の Window が閉じられてしまう #1109

Closed
rickhowe opened this Issue Oct 17, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@rickhowe

rickhowe commented Oct 17, 2017

編集中の Window で :q を実行しても
E37: No write since last change (add ! to override)
で現 Window は閉じられませんが、

2 つ以上に分割 split した Window から編集中の別の Window に対して
:3q や :$q などを実行すると、警告なしに閉じられてしまいます。

8.0.2 と 8.0.1203 で再現します。

次のように ex_docmd.c を修正すると直るようですがいかがでしょうか?
quit 対象となる Buffer が現 Buffer になっているようです。

--- 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);
     /* 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;
 #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
@h-east

This comment has been minimized.

Show comment
Hide comment
@h-east

h-east Oct 17, 2017

Member

👍 パッと見、良さそうです。

Member

h-east commented Oct 17, 2017

👍 パッと見、良さそうです。

@h-east

This comment has been minimized.

Show comment
Hide comment
@h-east

h-east Oct 20, 2017

Member

rickhowe さん自らpatch送付
https://groups.google.com/d/msg/vim_dev/-783hSvMqKg/g9ir5rZ9BgAJ

そして2つのpatchに分けて取り込まれました👍
patch 8.0.1204
patch 8.0.1205

Member

h-east commented Oct 20, 2017

rickhowe さん自らpatch送付
https://groups.google.com/d/msg/vim_dev/-783hSvMqKg/g9ir5rZ9BgAJ

そして2つのpatchに分けて取り込まれました👍
patch 8.0.1204
patch 8.0.1205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment