Mercurial > vim
comparison src/buffer.c @ 14744:1ae9c8a1b3bf v8.1.0384
patch 8.1.0384: sign ordering depends on +netbeans feature
commit https://github.com/vim/vim/commit/8aeb504fc68e3fea9da5567d2d9a31a132fbf90f
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Sep 13 18:33:05 2018 +0200
patch 8.1.0384: sign ordering depends on +netbeans feature
Problem: Sign ordering depends on +netbeans feature.
Solution: Also order signs without +netbeans. (Christian Brabandt,
closes #3224)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 13 Sep 2018 18:45:06 +0200 |
parents | 0a3b9ecf7cb8 |
children | 75d474a8868a |
comparison
equal
deleted
inserted
replaced
14743:d3d20dd1de5b | 14744:1ae9c8a1b3bf |
---|---|
5854 { | 5854 { |
5855 newsign->id = id; | 5855 newsign->id = id; |
5856 newsign->lnum = lnum; | 5856 newsign->lnum = lnum; |
5857 newsign->typenr = typenr; | 5857 newsign->typenr = typenr; |
5858 newsign->next = next; | 5858 newsign->next = next; |
5859 #ifdef FEAT_NETBEANS_INTG | |
5860 newsign->prev = prev; | 5859 newsign->prev = prev; |
5861 if (next != NULL) | 5860 if (next != NULL) |
5862 next->prev = newsign; | 5861 next->prev = newsign; |
5863 #endif | |
5864 | 5862 |
5865 if (prev == NULL) | 5863 if (prev == NULL) |
5866 { | 5864 { |
5867 /* When adding first sign need to redraw the windows to create the | 5865 /* When adding first sign need to redraw the windows to create the |
5868 * column for signs. */ | 5866 * column for signs. */ |
5903 if (lnum == sign->lnum && id == sign->id) | 5901 if (lnum == sign->lnum && id == sign->id) |
5904 { | 5902 { |
5905 sign->typenr = typenr; | 5903 sign->typenr = typenr; |
5906 return; | 5904 return; |
5907 } | 5905 } |
5908 else if ( | 5906 else if (lnum < sign->lnum) |
5909 #ifndef FEAT_NETBEANS_INTG /* keep signs sorted by lnum */ | 5907 { |
5910 id < 0 && | 5908 // keep signs sorted by lnum: insert new sign at head of list for |
5911 #endif | 5909 // this lnum |
5912 lnum < sign->lnum) | |
5913 { | |
5914 #ifdef FEAT_NETBEANS_INTG /* insert new sign at head of list for this lnum */ | |
5915 /* XXX - GRP: Is this because of sign slide problem? Or is it | |
5916 * really needed? Or is it because we allow multiple signs per | |
5917 * line? If so, should I add that feature to FEAT_SIGNS? | |
5918 */ | |
5919 while (prev != NULL && prev->lnum == lnum) | 5910 while (prev != NULL && prev->lnum == lnum) |
5920 prev = prev->prev; | 5911 prev = prev->prev; |
5921 if (prev == NULL) | 5912 if (prev == NULL) |
5922 sign = buf->b_signlist; | 5913 sign = buf->b_signlist; |
5923 else | 5914 else |
5924 sign = prev->next; | 5915 sign = prev->next; |
5925 #endif | |
5926 insert_sign(buf, prev, sign, id, lnum, typenr); | 5916 insert_sign(buf, prev, sign, id, lnum, typenr); |
5927 return; | 5917 return; |
5928 } | 5918 } |
5929 prev = sign; | 5919 prev = sign; |
5930 } | 5920 } |
5931 #ifdef FEAT_NETBEANS_INTG /* insert new sign at head of list for this lnum */ | 5921 |
5932 /* XXX - GRP: See previous comment */ | 5922 // insert new sign at head of list for this lnum |
5933 while (prev != NULL && prev->lnum == lnum) | 5923 while (prev != NULL && prev->lnum == lnum) |
5934 prev = prev->prev; | 5924 prev = prev->prev; |
5935 if (prev == NULL) | 5925 if (prev == NULL) |
5936 sign = buf->b_signlist; | 5926 sign = buf->b_signlist; |
5937 else | 5927 else |
5938 sign = prev->next; | 5928 sign = prev->next; |
5939 #endif | |
5940 insert_sign(buf, prev, sign, id, lnum, typenr); | 5929 insert_sign(buf, prev, sign, id, lnum, typenr); |
5941 | 5930 |
5942 return; | 5931 return; |
5943 } | 5932 } |
5944 | 5933 |
6006 { | 5995 { |
6007 next = sign->next; | 5996 next = sign->next; |
6008 if (sign->id == id) | 5997 if (sign->id == id) |
6009 { | 5998 { |
6010 *lastp = next; | 5999 *lastp = next; |
6011 #ifdef FEAT_NETBEANS_INTG | |
6012 if (next != NULL) | 6000 if (next != NULL) |
6013 next->prev = sign->prev; | 6001 next->prev = sign->prev; |
6014 #endif | |
6015 lnum = sign->lnum; | 6002 lnum = sign->lnum; |
6016 vim_free(sign); | 6003 vim_free(sign); |
6017 break; | 6004 break; |
6018 } | 6005 } |
6019 else | 6006 else |
6065 return 0; | 6052 return 0; |
6066 } | 6053 } |
6067 | 6054 |
6068 | 6055 |
6069 # if defined(FEAT_NETBEANS_INTG) || defined(PROTO) | 6056 # if defined(FEAT_NETBEANS_INTG) || defined(PROTO) |
6070 /* see if a given type of sign exists on a specific line */ | 6057 /* |
6058 * See if a given type of sign exists on a specific line. | |
6059 */ | |
6071 int | 6060 int |
6072 buf_findsigntype_id( | 6061 buf_findsigntype_id( |
6073 buf_T *buf, /* buffer whose sign we are searching for */ | 6062 buf_T *buf, /* buffer whose sign we are searching for */ |
6074 linenr_T lnum, /* line number of sign */ | 6063 linenr_T lnum, /* line number of sign */ |
6075 int typenr) /* sign type number */ | 6064 int typenr) /* sign type number */ |
6083 return 0; | 6072 return 0; |
6084 } | 6073 } |
6085 | 6074 |
6086 | 6075 |
6087 # if defined(FEAT_SIGN_ICONS) || defined(PROTO) | 6076 # if defined(FEAT_SIGN_ICONS) || defined(PROTO) |
6088 /* return the number of icons on the given line */ | 6077 /* |
6078 * Return the number of icons on the given line. | |
6079 */ | |
6089 int | 6080 int |
6090 buf_signcount(buf_T *buf, linenr_T lnum) | 6081 buf_signcount(buf_T *buf, linenr_T lnum) |
6091 { | 6082 { |
6092 signlist_T *sign; /* a sign in the signlist */ | 6083 signlist_T *sign; /* a sign in the signlist */ |
6093 int count = 0; | 6084 int count = 0; |