main.c: "BufReadCmd term://": Skip existing terminal.

Check `exists('b:term_title')` to avoid the BufReadCmd for already-initialized
:terminal buffers.

Move the test for `:argadd`.
Add a test for `:edit<CR>`.
Tweak comments and code style.
This commit is contained in:
Justin M. Keyes
2016-10-09 16:00:12 +02:00
parent 538255c228
commit 6b7faf22f4
8 changed files with 92 additions and 42 deletions

View File

@@ -276,30 +276,25 @@ bool buf_valid(buf_T *buf)
return false;
}
/*
* Close the link to a buffer.
* "action" is used when there is no longer a window for the buffer.
* It can be:
* 0 buffer becomes hidden
* DOBUF_UNLOAD buffer is unloaded
* DOBUF_DELETE buffer is unloaded and removed from buffer list
* DOBUF_WIPE buffer is unloaded and really deleted
* When doing all but the first one on the current buffer, the caller should
* get a new buffer very soon!
*
* The 'bufhidden' option can force freeing and deleting.
*
* When "abort_if_last" is TRUE then do not close the buffer if autocommands
* cause there to be only one window with this buffer. e.g. when ":quit" is
* supposed to close the window but autocommands close all other windows.
*/
void
close_buffer (
win_T *win, /* if not NULL, set b_last_cursor */
buf_T *buf,
int action,
int abort_if_last
)
/// Close the link to a buffer.
///
/// @param win If not NULL, set b_last_cursor.
/// @param buf
/// @param action Used when there is no longer a window for the buffer.
/// Possible values:
/// 0 buffer becomes hidden
/// DOBUF_UNLOAD buffer is unloaded
/// DOBUF_DELETE buffer is unloaded and removed from buffer list
/// DOBUF_WIPE buffer is unloaded and really deleted
/// When doing all but the first one on the current buffer, the
/// caller should get a new buffer very soon!
/// The 'bufhidden' option can force freeing and deleting.
/// @param abort_if_last
/// If TRUE, do not close the buffer if autocommands cause
/// there to be only one window with this buffer. e.g. when
/// ":quit" is supposed to close the window but autocommands
/// close all other windows.
void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
{
bool unload_buf = (action != 0);
bool del_buf = (action == DOBUF_DEL || action == DOBUF_WIPE);