diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-04-13 19:46:21 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-04-14 19:09:19 -0400 |
commit | 6de1ed1ff11a59b063ae8d199aab17977d7b445f (patch) | |
tree | f5157f3eb49856987dd9b84c89f322a40b9e57d2 /src | |
parent | 8f2175e7d052e219a68e75640cf6547251d335c2 (diff) | |
download | rneovim-6de1ed1ff11a59b063ae8d199aab17977d7b445f.tar.gz rneovim-6de1ed1ff11a59b063ae8d199aab17977d7b445f.tar.bz2 rneovim-6de1ed1ff11a59b063ae8d199aab17977d7b445f.zip |
vim-patch:8.0.0776: function prototypes missing without the quickfix feature
Problem: Function prototypes missing without the quickfix feature. (Tony
Mechelynck)
Solution: Move non-quickfix functions to buffer.c.
https://github.com/vim/vim/commit/f0a521f4f76904edb74e182c12732189b347ff68
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/buffer.c | 49 | ||||
-rw-r--r-- | src/nvim/if_cscope.c | 4 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 53 | ||||
-rw-r--r-- | src/nvim/undo.c | 6 |
4 files changed, 51 insertions, 61 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index b9c4c4d544..d628c517bb 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -5142,6 +5142,55 @@ bool bt_help(const buf_T *const buf) return buf != NULL && buf->b_help; } +// Return true if "buf" is the quickfix buffer. +bool bt_quickfix(const buf_T *const buf) +{ + return buf != NULL && buf->b_p_bt[0] == 'q'; +} + +// Return true if "buf" is a terminal buffer. +bool bt_terminal(const buf_T *const buf) +{ + return buf != NULL && buf->b_p_bt[0] == 't'; +} + +// Return true if "buf" is a "nofile", "acwrite" or "terminal" buffer. +// This means the buffer name is not a file name. +bool bt_nofile(const buf_T *const buf) +{ + return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') + || buf->b_p_bt[0] == 'a' || buf->terminal); +} + +// Return true if "buf" is a "nowrite", "nofile" or "terminal" buffer. +bool bt_dontwrite(const buf_T *const buf) +{ + return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->terminal); +} + +bool bt_dontwrite_msg(const buf_T *const buf) +{ + if (bt_dontwrite(buf)) { + EMSG(_("E382: Cannot write, 'buftype' option is set")); + return true; + } + return false; +} + +// Return true if the buffer should be hidden, according to 'hidden', ":hide" +// and 'bufhidden'. +bool buf_hide(const buf_T *const buf) +{ + // 'bufhidden' overrules 'hidden' and ":hide", check it first + switch (buf->b_p_bh[0]) { + case 'u': // "unload" + case 'w': // "wipe" + case 'd': return false; // "delete" + case 'h': return true; // "hide" + } + return p_hid || cmdmod.hide; +} + /* * Return special buffer name. * Returns NULL when the buffer has a normal file name. diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c index 625d6baa17..8b6fd6c705 100644 --- a/src/nvim/if_cscope.c +++ b/src/nvim/if_cscope.c @@ -16,11 +16,10 @@ #include <inttypes.h> #include <fcntl.h> -#include "nvim/vim.h" +#include "nvim/buffer.h" #include "nvim/ascii.h" #include "nvim/if_cscope.h" #include "nvim/charset.h" -#include "nvim/eval.h" #include "nvim/fileio.h" #include "nvim/message.h" #include "nvim/memory.h" @@ -29,7 +28,6 @@ #include "nvim/quickfix.h" #include "nvim/strings.h" #include "nvim/tag.h" -#include "nvim/window.h" #include "nvim/os/os.h" #include "nvim/os/input.h" #include "nvim/event/stream.h" diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 58de64d05b..6444661512 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -3167,59 +3167,6 @@ static void qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) } /* - * Return TRUE if "buf" is the quickfix buffer. - */ -int bt_quickfix(const buf_T *const buf) -{ - return buf != NULL && buf->b_p_bt[0] == 'q'; -} - -// Return true if "buf" is a terminal buffer. -bool bt_terminal(const buf_T *buf) -{ - return buf != NULL && buf->b_p_bt[0] == 't'; -} - -// Return TRUE if "buf" is a "nofile", "acwrite" or "terminal" buffer. -// This means the buffer name is not a file name. -int bt_nofile(buf_T *buf) -{ - return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f') - || buf->b_p_bt[0] == 'a' || buf->terminal); -} - -// Return TRUE if "buf" is a "nowrite", "nofile" or "terminal" buffer. -int bt_dontwrite(buf_T *buf) -{ - return buf != NULL && (buf->b_p_bt[0] == 'n' || buf->terminal); -} - -int bt_dontwrite_msg(buf_T *buf) -{ - if (bt_dontwrite(buf)) { - EMSG(_("E382: Cannot write, 'buftype' option is set")); - return TRUE; - } - return FALSE; -} - -/* - * Return TRUE if the buffer should be hidden, according to 'hidden', ":hide" - * and 'bufhidden'. - */ -int buf_hide(buf_T *buf) -{ - /* 'bufhidden' overrules 'hidden' and ":hide", check it first */ - switch (buf->b_p_bh[0]) { - case 'u': /* "unload" */ - case 'w': /* "wipe" */ - case 'd': return FALSE; /* "delete" */ - case 'h': return TRUE; /* "hide" */ - } - return p_hid || cmdmod.hide; -} - -/* * Return TRUE when using ":vimgrep" for ":grep". */ int grep_internal(cmdidx_T cmdidx) diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 41393c7ef4..8bb1b9e745 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -83,13 +83,11 @@ #include <string.h> #include <fcntl.h> -#include "nvim/vim.h" +#include "nvim/buffer.h" #include "nvim/ascii.h" #include "nvim/undo.h" -#include "nvim/macros.h" #include "nvim/cursor.h" #include "nvim/edit.h" -#include "nvim/eval.h" #include "nvim/fileio.h" #include "nvim/fold.h" #include "nvim/buffer_updates.h" @@ -102,8 +100,6 @@ #include "nvim/option.h" #include "nvim/os_unix.h" #include "nvim/path.h" -#include "nvim/quickfix.h" -#include "nvim/screen.h" #include "nvim/sha256.h" #include "nvim/state.h" #include "nvim/strings.h" |