diff options
author | Tommy Allen <tommy@esdf.io> | 2016-07-28 14:14:53 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-07-28 14:14:53 -0400 |
commit | 1f7304b84681f3afae55d762e28f1ec6efe375a6 (patch) | |
tree | a096e682a49235c49477b6d1a26adbc00f1ed0e6 /src/nvim/syntax.c | |
parent | 56f178058a25d550568d9673b13f08cfa1510a75 (diff) | |
download | rneovim-1f7304b84681f3afae55d762e28f1ec6efe375a6.tar.gz rneovim-1f7304b84681f3afae55d762e28f1ec6efe375a6.tar.bz2 rneovim-1f7304b84681f3afae55d762e28f1ec6efe375a6.zip |
mouse.c: Adjust clicked column if chars are concealed (#5087)
syntax.c: Added syn_get_concealed_id()
tests: Added tests for mouse clicks on concealed text.
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r-- | src/nvim/syntax.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 27855184df..3215f7ea14 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -5661,6 +5661,24 @@ int get_syntax_info(int *seqnrp) return current_flags; } + +/// Get the sequence number of the concealed file position. +/// +/// @return seqnr if the file position is concealed, 0 otherwise. +int syn_get_concealed_id(win_T *wp, linenr_T lnum, colnr_T col) +{ + int seqnr; + int syntax_flags; + + (void)syn_get_id(wp, lnum, col, false, NULL, false); + syntax_flags = get_syntax_info(&seqnr); + + if (syntax_flags & HL_CONCEAL) { + return seqnr; + } + return 0; +} + /* * Return conceal substitution character */ |