mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 01:34:25 +00:00 
			
		
		
		
	vim-patch:8.0.1525: using :wqa exits even if a job runs in a terminal window
Problem:    Using :wqa exits even if a job runs in a terminal window. (Jason
            Felice)
Solution:   Check if a terminal has a running job. (closes vim/vim#2654)
7a76092a51
			
			
This commit is contained in:
		@@ -1645,10 +1645,11 @@ void no_write_message(void)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void no_write_message_nobang(void)
 | 
					void no_write_message_nobang(const buf_T *const buf)
 | 
				
			||||||
 | 
					  FUNC_ATTR_NONNULL_ALL
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (curbuf->terminal
 | 
					  if (buf->terminal
 | 
				
			||||||
      && channel_job_running((uint64_t)curbuf->b_p_channel)) {
 | 
					      && channel_job_running((uint64_t)buf->b_p_channel)) {
 | 
				
			||||||
    EMSG(_("E948: Job still running"));
 | 
					    EMSG(_("E948: Job still running"));
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    EMSG(_("E37: No write since last change"));
 | 
					    EMSG(_("E37: No write since last change"));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1965,7 +1965,12 @@ void do_wqall(exarg_T *eap)
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  FOR_ALL_BUFFERS(buf) {
 | 
					  FOR_ALL_BUFFERS(buf) {
 | 
				
			||||||
    if (!bufIsChanged(buf) || bt_dontwrite(buf)) {
 | 
					    if (exiting
 | 
				
			||||||
 | 
					        && buf->terminal
 | 
				
			||||||
 | 
					        && channel_job_running((uint64_t)buf->b_p_channel)) {
 | 
				
			||||||
 | 
					      no_write_message_nobang(buf);
 | 
				
			||||||
 | 
					      error++;
 | 
				
			||||||
 | 
					    } else if (!bufIsChanged(buf) || bt_dontwrite(buf)) {
 | 
				
			||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1297,7 +1297,7 @@ bool check_changed(buf_T *buf, int flags)
 | 
				
			|||||||
    if (flags & CCGD_EXCMD) {
 | 
					    if (flags & CCGD_EXCMD) {
 | 
				
			||||||
      no_write_message();
 | 
					      no_write_message();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      no_write_message_nobang();
 | 
					      no_write_message_nobang(curbuf);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,6 +6,7 @@ local eval, feed_command, source = helpers.eval, helpers.feed_command, helpers.s
 | 
				
			|||||||
local eq, neq = helpers.eq, helpers.neq
 | 
					local eq, neq = helpers.eq, helpers.neq
 | 
				
			||||||
local write_file = helpers.write_file
 | 
					local write_file = helpers.write_file
 | 
				
			||||||
local command= helpers.command
 | 
					local command= helpers.command
 | 
				
			||||||
 | 
					local exc_exec = helpers.exc_exec
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe(':terminal buffer', function()
 | 
					describe(':terminal buffer', function()
 | 
				
			||||||
  local screen
 | 
					  local screen
 | 
				
			||||||
@@ -253,6 +254,10 @@ describe(':terminal buffer', function()
 | 
				
			|||||||
    ]])
 | 
					    ]])
 | 
				
			||||||
    command('bdelete!')
 | 
					    command('bdelete!')
 | 
				
			||||||
  end)
 | 
					  end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  it('handles wqall', function()
 | 
				
			||||||
 | 
					    eq('Vim(wqall):E948: Job still running', exc_exec('wqall'))
 | 
				
			||||||
 | 
					  end)
 | 
				
			||||||
end)
 | 
					end)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
describe('No heap-buffer-overflow when using', function()
 | 
					describe('No heap-buffer-overflow when using', function()
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user