Mercurial > vim
changeset 29540:9b8ab82e3b0b v9.0.0111
patch 9.0.0111: "nocombine" is missing from synIDattr()
Commit: https://github.com/vim/vim/commit/de78632c41d870d5254e9ccd285f53674b955f4e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jul 30 14:56:17 2022 +0100
patch 9.0.0111: "nocombine" is missing from synIDattr()
Problem: "nocombine" is missing from synIDattr().
Solution: Add "nocombine". (Muni Tanjim, closes https://github.com/vim/vim/issues/10816)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 30 Jul 2022 16:00:02 +0200 |
parents | 73c769741c52 |
children | bc0ca8c97c25 |
files | runtime/doc/builtin.txt src/evalfunc.c src/testdir/test_syn_attr.vim src/version.c |
diffstat | 4 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -9233,6 +9233,7 @@ synIDattr({synID}, {what} [, {mode}]) "underline" "1" if underlined "undercurl" "1" if undercurled "strike" "1" if strikethrough + "nocombine" "1" if nocombine Returns an empty string on error.
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -10083,8 +10083,11 @@ f_synIDattr(typval_T *argvars UNUSED, ty p = highlight_has_attr(id, HL_ITALIC, modec); break; - case 'n': // name - p = get_highlight_name_ext(NULL, id - 1, FALSE); + case 'n': + if (TOLOWER_ASC(what[1]) == 'o') // nocombine + p = highlight_has_attr(id, HL_NOCOMBINE, modec); + else // name + p = get_highlight_name_ext(NULL, id - 1, FALSE); break; case 'r': // reverse
--- a/src/testdir/test_syn_attr.vim +++ b/src/testdir/test_syn_attr.vim @@ -22,8 +22,10 @@ func Test_missing_attr() call assert_equal('1', synIDattr(hlID("Mine"), "underdotted", 'cterm')) call assert_equal('1', synIDattr("Mine"->hlID(), "underdashed", 'gui')) - hi Mine gui=strikethrough + hi Mine term=nocombine gui=strikethrough call assert_equal('1', synIDattr(hlID("Mine"), "strikethrough", 'gui')) + call assert_equal('1', synIDattr(hlID("Mine"), "nocombine", 'term')) + call assert_equal('', synIDattr(hlID("Mine"), "nocombine", 'gui')) hi Mine term=NONE cterm=NONE gui=NONE call assert_equal('', synIDattr(hlID("Mine"), "bold", 'term')) call assert_equal('', synIDattr(hlID("Mine"), "italic", 'cterm'))