aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorReto Schnyder <reto.a.schnyder@bluewin.ch>2018-10-13 19:33:08 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-10-13 19:39:56 +0200
commitbddcbbb5716a005001da3bacb4c1df4ae05e51bc (patch)
tree5317a4d71a4e2ab1ac8e966adfcbff086d0cc2fa /src/nvim/buffer.c
parent8bbb28b9732bfa430a963f16498d8ec42c637ca9 (diff)
downloadrneovim-bddcbbb5716a005001da3bacb4c1df4ae05e51bc.tar.gz
rneovim-bddcbbb5716a005001da3bacb4c1df4ae05e51bc.tar.bz2
rneovim-bddcbbb5716a005001da3bacb4c1df4ae05e51bc.zip
signs: Add "numhl" argument #9113
close #9113 ref #9040
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 68f6ff303b..ce6aa69239 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -5084,13 +5084,16 @@ linenr_T buf_change_sign_type(
return (linenr_T)0;
}
-int buf_getsigntype(
- buf_T *buf,
- linenr_T lnum,
- int type /* SIGN_ICON, SIGN_TEXT, SIGN_ANY, SIGN_LINEHL */
- )
+/// Gets a sign from a given line.
+/// In case of multiple signs, returns the most recently placed one.
+///
+/// @param buf Buffer in which to search
+/// @param lnum Line in which to search
+/// @param type Type of sign to look for
+/// @return Identifier of the first matching sign, or 0
+int buf_getsigntype(buf_T *buf, linenr_T lnum, SignType type)
{
- signlist_T *sign; /* a sign in a b_signlist */
+ signlist_T *sign; // a sign in a b_signlist
for (sign = buf->b_signlist; sign != NULL; sign = sign->next) {
if (sign->lnum == lnum
@@ -5098,7 +5101,9 @@ int buf_getsigntype(
|| (type == SIGN_TEXT
&& sign_get_text(sign->typenr) != NULL)
|| (type == SIGN_LINEHL
- && sign_get_attr(sign->typenr, TRUE) != 0))) {
+ && sign_get_attr(sign->typenr, SIGN_LINEHL) != 0)
+ || (type == SIGN_NUMHL
+ && sign_get_attr(sign->typenr, SIGN_NUMHL) != 0))) {
return sign->typenr;
}
}