diff options
author | Kurt Bonatz <Kurt-Bonatz@users.noreply.github.com> | 2017-02-18 05:04:46 -0800 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-02-18 14:04:46 +0100 |
commit | b0bbe82a60ea65e94d6fd4fdc2a13b45aa457973 (patch) | |
tree | b42bb0eadde84802520ccde329bc9922b1c3766f | |
parent | 158ea528545463a80ddce2cc83e52eb3b291cfa5 (diff) | |
download | rneovim-b0bbe82a60ea65e94d6fd4fdc2a13b45aa457973.tar.gz rneovim-b0bbe82a60ea65e94d6fd4fdc2a13b45aa457973.tar.bz2 rneovim-b0bbe82a60ea65e94d6fd4fdc2a13b45aa457973.zip |
eval.c: has("unnamedplus"). (#6136)
Return 1 for UNIX with a functioning clipboard provider.
Closes #6103
-rw-r--r-- | src/nvim/eval.c | 4 | ||||
-rw-r--r-- | test/functional/eval/has_spec.lua | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index d98df6a06e..18b5de7e62 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -11442,6 +11442,10 @@ static void f_has(typval_T *argvars, typval_T *rettv, FunPtr fptr) #endif } else if (STRICMP(name, "syntax_items") == 0) { n = syntax_present(curwin); +#ifdef UNIX + } else if (STRICMP(name, "unnamedplus") == 0) { + n = eval_has_provider("clipboard"); +#endif } } diff --git a/test/functional/eval/has_spec.lua b/test/functional/eval/has_spec.lua index 97b3b0e620..78c4e08fde 100644 --- a/test/functional/eval/has_spec.lua +++ b/test/functional/eval/has_spec.lua @@ -2,6 +2,7 @@ local helpers = require('test.functional.helpers')(after_each) local eq = helpers.eq local clear = helpers.clear local funcs = helpers.funcs +local iswin = helpers.iswin describe('has()', function() before_each(clear) @@ -49,4 +50,11 @@ describe('has()', function() eq(1, funcs.has("nvim-00.001.05")) end) + it('"unnamedplus"', function() + if (not iswin()) and funcs.has("clipboard") == 1 then + eq(1, funcs.has("unnamedplus")) + else + eq(0, funcs.has("unnamedplus")) + end + end) end) |