forked from aniani/vim
patch 8.1.0673: functionality for signs is spread out over several files
Problem: Functionality for signs is spread out over several files. Solution: Move most of the sign functionality into sign.c. (Yegappan Lakshmanan, closes #3751)
This commit is contained in:
4
Filelist
4
Filelist
@@ -81,10 +81,11 @@ SRC_ALL = \
|
|||||||
src/screen.c \
|
src/screen.c \
|
||||||
src/search.c \
|
src/search.c \
|
||||||
src/sha256.c \
|
src/sha256.c \
|
||||||
src/structs.h \
|
src/sign.c \
|
||||||
src/spell.c \
|
src/spell.c \
|
||||||
src/spell.h \
|
src/spell.h \
|
||||||
src/spellfile.c \
|
src/spellfile.c \
|
||||||
|
src/structs.h \
|
||||||
src/syntax.c \
|
src/syntax.c \
|
||||||
src/tag.c \
|
src/tag.c \
|
||||||
src/term.c \
|
src/term.c \
|
||||||
@@ -192,6 +193,7 @@ SRC_ALL = \
|
|||||||
src/proto/screen.pro \
|
src/proto/screen.pro \
|
||||||
src/proto/search.pro \
|
src/proto/search.pro \
|
||||||
src/proto/sha256.pro \
|
src/proto/sha256.pro \
|
||||||
|
src/proto/sign.pro \
|
||||||
src/proto/spell.pro \
|
src/proto/spell.pro \
|
||||||
src/proto/spellfile.pro \
|
src/proto/spellfile.pro \
|
||||||
src/proto/syntax.pro \
|
src/proto/syntax.pro \
|
||||||
|
@@ -581,6 +581,7 @@ vimobj = \
|
|||||||
$(OBJDIR)\screen.obj \
|
$(OBJDIR)\screen.obj \
|
||||||
$(OBJDIR)\search.obj \
|
$(OBJDIR)\search.obj \
|
||||||
$(OBJDIR)\sha256.obj \
|
$(OBJDIR)\sha256.obj \
|
||||||
|
$(OBJDIR)\sign.obj \
|
||||||
$(OBJDIR)\spell.obj \
|
$(OBJDIR)\spell.obj \
|
||||||
$(OBJDIR)\spellfile.obj \
|
$(OBJDIR)\spellfile.obj \
|
||||||
$(OBJDIR)\syntax.obj \
|
$(OBJDIR)\syntax.obj \
|
||||||
|
@@ -746,6 +746,7 @@ OBJ = \
|
|||||||
$(OUTDIR)/screen.o \
|
$(OUTDIR)/screen.o \
|
||||||
$(OUTDIR)/search.o \
|
$(OUTDIR)/search.o \
|
||||||
$(OUTDIR)/sha256.o \
|
$(OUTDIR)/sha256.o \
|
||||||
|
$(OUTDIR)/sign.o \
|
||||||
$(OUTDIR)/spell.o \
|
$(OUTDIR)/spell.o \
|
||||||
$(OUTDIR)/spellfile.o \
|
$(OUTDIR)/spellfile.o \
|
||||||
$(OUTDIR)/syntax.o \
|
$(OUTDIR)/syntax.o \
|
||||||
|
@@ -71,6 +71,7 @@ SRC = \
|
|||||||
screen.c \
|
screen.c \
|
||||||
search.c \
|
search.c \
|
||||||
sha256.c \
|
sha256.c \
|
||||||
|
sign.c \
|
||||||
spell.c \
|
spell.c \
|
||||||
spellfile.c \
|
spellfile.c \
|
||||||
syntax.c \
|
syntax.c \
|
||||||
@@ -127,6 +128,7 @@ OBJ = o/arabic.o \
|
|||||||
o/screen.o \
|
o/screen.o \
|
||||||
o/search.o \
|
o/search.o \
|
||||||
o/sha256.o \
|
o/sha256.o \
|
||||||
|
o/sign.o \
|
||||||
o/spell.o \
|
o/spell.o \
|
||||||
o/spellfile.o \
|
o/spellfile.o \
|
||||||
o/syntax.o \
|
o/syntax.o \
|
||||||
@@ -252,6 +254,8 @@ o/search.o: search.c $(SYMS) regexp.h
|
|||||||
|
|
||||||
o/sha256.o: sha256.c $(SYMS)
|
o/sha256.o: sha256.c $(SYMS)
|
||||||
|
|
||||||
|
o/sign.o: sign.c $(SYMS)
|
||||||
|
|
||||||
o/spell.o: spell.c $(SYMS) spell.h
|
o/spell.o: spell.c $(SYMS) spell.h
|
||||||
|
|
||||||
o/spellfile.o: spellfile.c $(SYMS) spell.h
|
o/spellfile.o: spellfile.c $(SYMS) spell.h
|
||||||
|
@@ -257,6 +257,7 @@ LINK32_OBJS= \
|
|||||||
"$(INTDIR)/screen.obj" \
|
"$(INTDIR)/screen.obj" \
|
||||||
"$(INTDIR)/search.obj" \
|
"$(INTDIR)/search.obj" \
|
||||||
"$(INTDIR)/sha256.obj" \
|
"$(INTDIR)/sha256.obj" \
|
||||||
|
"$(INTDIR)/sign.obj" \
|
||||||
"$(INTDIR)/spell.obj" \
|
"$(INTDIR)/spell.obj" \
|
||||||
"$(INTDIR)/spellfile.obj" \
|
"$(INTDIR)/spellfile.obj" \
|
||||||
"$(INTDIR)/syntax.obj" \
|
"$(INTDIR)/syntax.obj" \
|
||||||
@@ -675,6 +676,10 @@ SOURCE=.\sha256.c
|
|||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\sign.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\spell.c
|
SOURCE=.\spell.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@@ -81,6 +81,7 @@ SRC = arabic.c \
|
|||||||
screen.c \
|
screen.c \
|
||||||
search.c \
|
search.c \
|
||||||
sha256.c \
|
sha256.c \
|
||||||
|
sign.c \
|
||||||
spell.c \
|
spell.c \
|
||||||
spellfile.c \
|
spellfile.c \
|
||||||
syntax.c \
|
syntax.c \
|
||||||
@@ -139,6 +140,7 @@ OBJ = obj/arabic.o \
|
|||||||
obj/screen.o \
|
obj/screen.o \
|
||||||
obj/search.o \
|
obj/search.o \
|
||||||
obj/sha256.o \
|
obj/sha256.o \
|
||||||
|
obj/sign.o \
|
||||||
obj/spell.o \
|
obj/spell.o \
|
||||||
obj/spellfile.o \
|
obj/spellfile.o \
|
||||||
obj/syntax.o \
|
obj/syntax.o \
|
||||||
@@ -195,6 +197,7 @@ PRO = proto/arabic.pro \
|
|||||||
proto/screen.pro \
|
proto/screen.pro \
|
||||||
proto/search.pro \
|
proto/search.pro \
|
||||||
proto/sha256.pro \
|
proto/sha256.pro \
|
||||||
|
proto/sign.pro \
|
||||||
proto/spell.pro \
|
proto/spell.pro \
|
||||||
proto/spellfile.pro \
|
proto/spellfile.pro \
|
||||||
proto/syntax.pro \
|
proto/syntax.pro \
|
||||||
@@ -389,6 +392,9 @@ obj/search.o: search.c
|
|||||||
obj/sha256.o: sha256.c
|
obj/sha256.o: sha256.c
|
||||||
$(CCSYM) $@ sha256.c
|
$(CCSYM) $@ sha256.c
|
||||||
|
|
||||||
|
obj/sign.o: sign.c
|
||||||
|
$(CCSYM) $@ sign.c
|
||||||
|
|
||||||
obj/spell.o: spell.c
|
obj/spell.o: spell.c
|
||||||
$(CCSYM) $@ spell.c
|
$(CCSYM) $@ spell.c
|
||||||
|
|
||||||
|
@@ -69,6 +69,7 @@ SRC = arabic.c \
|
|||||||
screen.c \
|
screen.c \
|
||||||
search.c \
|
search.c \
|
||||||
sha256.c \
|
sha256.c \
|
||||||
|
sign.c \
|
||||||
spell.c \
|
spell.c \
|
||||||
spellfile.c \
|
spellfile.c \
|
||||||
syntax.c \
|
syntax.c \
|
||||||
|
@@ -749,6 +749,7 @@ OBJ = \
|
|||||||
$(OUTDIR)\screen.obj \
|
$(OUTDIR)\screen.obj \
|
||||||
$(OUTDIR)\search.obj \
|
$(OUTDIR)\search.obj \
|
||||||
$(OUTDIR)\sha256.obj \
|
$(OUTDIR)\sha256.obj \
|
||||||
|
$(OUTDIR)\sign.obj \
|
||||||
$(OUTDIR)\spell.obj \
|
$(OUTDIR)\spell.obj \
|
||||||
$(OUTDIR)\spellfile.obj \
|
$(OUTDIR)\spellfile.obj \
|
||||||
$(OUTDIR)\syntax.obj \
|
$(OUTDIR)\syntax.obj \
|
||||||
@@ -1519,6 +1520,8 @@ $(OUTDIR)/search.obj: $(OUTDIR) search.c $(INCL)
|
|||||||
|
|
||||||
$(OUTDIR)/sha256.obj: $(OUTDIR) sha256.c $(INCL)
|
$(OUTDIR)/sha256.obj: $(OUTDIR) sha256.c $(INCL)
|
||||||
|
|
||||||
|
$(OUTDIR)/sign.obj: $(OUTDIR) sign.c $(INCL)
|
||||||
|
|
||||||
$(OUTDIR)/spell.obj: $(OUTDIR) spell.c $(INCL)
|
$(OUTDIR)/spell.obj: $(OUTDIR) spell.c $(INCL)
|
||||||
|
|
||||||
$(OUTDIR)/spellfile.obj: $(OUTDIR) spellfile.c $(INCL)
|
$(OUTDIR)/spellfile.obj: $(OUTDIR) spellfile.c $(INCL)
|
||||||
@@ -1664,6 +1667,7 @@ proto.h: \
|
|||||||
proto/screen.pro \
|
proto/screen.pro \
|
||||||
proto/search.pro \
|
proto/search.pro \
|
||||||
proto/sha256.pro \
|
proto/sha256.pro \
|
||||||
|
proto/sign.pro \
|
||||||
proto/spell.pro \
|
proto/spell.pro \
|
||||||
proto/spellfile.pro \
|
proto/spellfile.pro \
|
||||||
proto/syntax.pro \
|
proto/syntax.pro \
|
||||||
|
@@ -134,6 +134,7 @@ SRC = \
|
|||||||
screen.c \
|
screen.c \
|
||||||
search.c \
|
search.c \
|
||||||
sha256.c \
|
sha256.c \
|
||||||
|
sign.c \
|
||||||
spell.c \
|
spell.c \
|
||||||
spellfile.c \
|
spellfile.c \
|
||||||
syntax.c \
|
syntax.c \
|
||||||
@@ -191,6 +192,7 @@ OBJ = \
|
|||||||
screen.o \
|
screen.o \
|
||||||
search.o \
|
search.o \
|
||||||
sha256.o \
|
sha256.o \
|
||||||
|
sign.o \
|
||||||
spell.o \
|
spell.o \
|
||||||
spellfile.o \
|
spellfile.o \
|
||||||
syntax.o \
|
syntax.o \
|
||||||
@@ -248,6 +250,7 @@ PRO = \
|
|||||||
proto/screen.pro \
|
proto/screen.pro \
|
||||||
proto/search.pro \
|
proto/search.pro \
|
||||||
proto/sha256.pro \
|
proto/sha256.pro \
|
||||||
|
proto/sign.pro \
|
||||||
proto/spell.pro \
|
proto/spell.pro \
|
||||||
proto/spellfile.pro \
|
proto/spellfile.pro \
|
||||||
proto/syntax.pro \
|
proto/syntax.pro \
|
||||||
@@ -404,6 +407,8 @@ search.o: search.c
|
|||||||
proto/search.pro: search.c
|
proto/search.pro: search.c
|
||||||
sha256.o: sha256.c
|
sha256.o: sha256.c
|
||||||
proto/sha256.pro: sha256.c
|
proto/sha256.pro: sha256.c
|
||||||
|
sign.o: sign.c
|
||||||
|
proto/sign.pro: sign.c
|
||||||
spell.o: spell.c
|
spell.o: spell.c
|
||||||
proto/spell.pro: spell.c
|
proto/spell.pro: spell.c
|
||||||
spellfile.o: spellfile.c
|
spellfile.o: spellfile.c
|
||||||
|
@@ -302,7 +302,7 @@ ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) \
|
|||||||
SRC = arabic.c beval.obj blowfish.c buffer.c charset.c crypt.c crypt_zip.c dict.c diff.c digraph.c edit.c eval.c evalfunc.c \
|
SRC = arabic.c beval.obj blowfish.c buffer.c charset.c crypt.c crypt_zip.c dict.c diff.c digraph.c edit.c eval.c evalfunc.c \
|
||||||
ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c if_cscope.c if_xcmdsrv.c farsi.c fileio.c fold.c getchar.c \
|
ex_cmds.c ex_cmds2.c ex_docmd.c ex_eval.c ex_getln.c if_cscope.c if_xcmdsrv.c farsi.c fileio.c fold.c getchar.c \
|
||||||
hardcopy.c hashtab.c json.c list.c main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \
|
hardcopy.c hashtab.c json.c list.c main.c mark.c menu.c mbyte.c memfile.c memline.c message.c misc1.c \
|
||||||
misc2.c move.c normal.c ops.c option.c popupmnu.c quickfix.c regexp.c search.c sha256.c\
|
misc2.c move.c normal.c ops.c option.c popupmnu.c quickfix.c regexp.c search.c sha256.c sign.c \
|
||||||
spell.c spellfile.c syntax.c tag.c term.c termlib.c ui.c undo.c userfunc.c version.c screen.c \
|
spell.c spellfile.c syntax.c tag.c term.c termlib.c ui.c undo.c userfunc.c version.c screen.c \
|
||||||
window.c os_unix.c os_vms.c pathdef.c \
|
window.c os_unix.c os_vms.c pathdef.c \
|
||||||
$(GUI_SRC) $(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) \
|
$(GUI_SRC) $(PERL_SRC) $(PYTHON_SRC) $(TCL_SRC) \
|
||||||
@@ -313,7 +313,7 @@ OBJ = arabic.obj beval.obj blowfish.obj buffer.obj charset.obj crypt.obj crypt_
|
|||||||
if_xcmdsrv.obj farsi.obj fileio.obj fold.obj getchar.obj hardcopy.obj hashtab.obj json.obj list.obj main.obj mark.obj \
|
if_xcmdsrv.obj farsi.obj fileio.obj fold.obj getchar.obj hardcopy.obj hashtab.obj json.obj list.obj main.obj mark.obj \
|
||||||
menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \
|
menu.obj memfile.obj memline.obj message.obj misc1.obj misc2.obj \
|
||||||
move.obj mbyte.obj normal.obj ops.obj option.obj popupmnu.obj quickfix.obj \
|
move.obj mbyte.obj normal.obj ops.obj option.obj popupmnu.obj quickfix.obj \
|
||||||
regexp.obj search.obj sha256.obj spell.obj spellfile.obj syntax.obj tag.obj term.obj termlib.obj \
|
regexp.obj search.obj sha256.obj sign.obj spell.obj spellfile.obj syntax.obj tag.obj term.obj termlib.obj \
|
||||||
ui.obj undo.obj userfunc.obj screen.obj version.obj window.obj os_unix.obj \
|
ui.obj undo.obj userfunc.obj screen.obj version.obj window.obj os_unix.obj \
|
||||||
os_vms.obj pathdef.obj if_mzsch.obj\
|
os_vms.obj pathdef.obj if_mzsch.obj\
|
||||||
$(GUI_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(TCL_OBJ) \
|
$(GUI_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(TCL_OBJ) \
|
||||||
@@ -677,6 +677,10 @@ sha256.obj : sha256.c vim.h [.auto]config.h feature.h os_unix.h \
|
|||||||
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
|
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
|
||||||
beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \
|
beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \
|
||||||
globals.h farsi.h arabic.h
|
globals.h farsi.h arabic.h
|
||||||
|
sign.obj : sign.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||||
|
ascii.h keymap.h term.h macros.h option.h structs.h regexp.h gui.h \
|
||||||
|
beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h proto.h \
|
||||||
|
globals.h farsi.h arabic.h
|
||||||
spell.obj : spell.c vim.h [.auto]config.h feature.h os_unix.h \
|
spell.obj : spell.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||||
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
||||||
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
||||||
|
10
src/Makefile
10
src/Makefile
@@ -1626,6 +1626,7 @@ BASIC_SRC = \
|
|||||||
screen.c \
|
screen.c \
|
||||||
search.c \
|
search.c \
|
||||||
sha256.c \
|
sha256.c \
|
||||||
|
sign.c \
|
||||||
spell.c \
|
spell.c \
|
||||||
spellfile.c \
|
spellfile.c \
|
||||||
syntax.c \
|
syntax.c \
|
||||||
@@ -1736,6 +1737,7 @@ OBJ_COMMON = \
|
|||||||
objects/screen.o \
|
objects/screen.o \
|
||||||
objects/search.o \
|
objects/search.o \
|
||||||
objects/sha256.o \
|
objects/sha256.o \
|
||||||
|
objects/sign.o \
|
||||||
objects/spell.o \
|
objects/spell.o \
|
||||||
objects/spellfile.o \
|
objects/spellfile.o \
|
||||||
objects/syntax.o \
|
objects/syntax.o \
|
||||||
@@ -1870,6 +1872,7 @@ PRO_AUTO = \
|
|||||||
screen.pro \
|
screen.pro \
|
||||||
search.pro \
|
search.pro \
|
||||||
sha256.pro \
|
sha256.pro \
|
||||||
|
sign.pro \
|
||||||
spell.pro \
|
spell.pro \
|
||||||
spellfile.pro \
|
spellfile.pro \
|
||||||
syntax.pro \
|
syntax.pro \
|
||||||
@@ -3200,6 +3203,9 @@ objects/search.o: search.c
|
|||||||
objects/sha256.o: sha256.c
|
objects/sha256.o: sha256.c
|
||||||
$(CCC) -o $@ sha256.c
|
$(CCC) -o $@ sha256.c
|
||||||
|
|
||||||
|
objects/sign.o: sign.c
|
||||||
|
$(CCC) -o $@ sign.c
|
||||||
|
|
||||||
objects/spell.o: spell.c
|
objects/spell.o: spell.c
|
||||||
$(CCC) -o $@ spell.c
|
$(CCC) -o $@ spell.c
|
||||||
|
|
||||||
@@ -3586,6 +3592,10 @@ objects/sha256.o: sha256.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
|||||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
proto.h globals.h farsi.h arabic.h
|
proto.h globals.h farsi.h arabic.h
|
||||||
|
objects/sign.o: sign.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||||
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
|
proto.h globals.h farsi.h arabic.h
|
||||||
objects/spell.o: spell.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
objects/spell.o: spell.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||||
|
@@ -35,6 +35,7 @@ Most code can be found in a file with an obvious name (incomplete list):
|
|||||||
regexp.c pattern matching
|
regexp.c pattern matching
|
||||||
screen.c updating the windows
|
screen.c updating the windows
|
||||||
search.c pattern searching
|
search.c pattern searching
|
||||||
|
sign.c signs
|
||||||
spell.c spell checking
|
spell.c spell checking
|
||||||
syntax.c syntax and other highlighting
|
syntax.c syntax and other highlighting
|
||||||
tag.c tags
|
tag.c tags
|
||||||
|
636
src/buffer.c
636
src/buffer.c
@@ -5864,642 +5864,6 @@ win_found:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FEAT_SIGNS) || defined(PROTO)
|
|
||||||
static hashtab_T sg_table; // sign group (signgroup_T) hashtable
|
|
||||||
static int next_sign_id = 1; // next sign id in the global group
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Initialize data needed for managing signs
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
init_signs(void)
|
|
||||||
{
|
|
||||||
hash_init(&sg_table); // sign group hash table
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A new sign in group 'groupname' is added. If the group is not present,
|
|
||||||
* create it. Otherwise reference the group.
|
|
||||||
*/
|
|
||||||
static signgroup_T *
|
|
||||||
sign_group_ref(char_u *groupname)
|
|
||||||
{
|
|
||||||
hash_T hash;
|
|
||||||
hashitem_T *hi;
|
|
||||||
signgroup_T *group;
|
|
||||||
|
|
||||||
hash = hash_hash(groupname);
|
|
||||||
hi = hash_lookup(&sg_table, groupname, hash);
|
|
||||||
if (HASHITEM_EMPTY(hi))
|
|
||||||
{
|
|
||||||
// new group
|
|
||||||
group = (signgroup_T *)alloc(
|
|
||||||
(unsigned)(sizeof(signgroup_T) + STRLEN(groupname)));
|
|
||||||
if (group == NULL)
|
|
||||||
return NULL;
|
|
||||||
STRCPY(group->sg_name, groupname);
|
|
||||||
group->refcount = 1;
|
|
||||||
group->next_sign_id = 1;
|
|
||||||
hash_add_item(&sg_table, hi, group->sg_name, hash);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// existing group
|
|
||||||
group = HI2SG(hi);
|
|
||||||
group->refcount++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return group;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A sign in group 'groupname' is removed. If all the signs in this group are
|
|
||||||
* removed, then remove the group.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
sign_group_unref(char_u *groupname)
|
|
||||||
{
|
|
||||||
hashitem_T *hi;
|
|
||||||
signgroup_T *group;
|
|
||||||
|
|
||||||
hi = hash_find(&sg_table, groupname);
|
|
||||||
if (!HASHITEM_EMPTY(hi))
|
|
||||||
{
|
|
||||||
group = HI2SG(hi);
|
|
||||||
group->refcount--;
|
|
||||||
if (group->refcount == 0)
|
|
||||||
{
|
|
||||||
// All the signs in this group are removed
|
|
||||||
hash_remove(&sg_table, hi);
|
|
||||||
vim_free(group);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Get the next free sign identifier in the specified group
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
sign_group_get_next_signid(buf_T *buf, char_u *groupname)
|
|
||||||
{
|
|
||||||
int id = 1;
|
|
||||||
signgroup_T *group = NULL;
|
|
||||||
signlist_T *sign;
|
|
||||||
hashitem_T *hi;
|
|
||||||
int found = FALSE;
|
|
||||||
|
|
||||||
if (groupname != NULL)
|
|
||||||
{
|
|
||||||
hi = hash_find(&sg_table, groupname);
|
|
||||||
if (HASHITEM_EMPTY(hi))
|
|
||||||
return id;
|
|
||||||
group = HI2SG(hi);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Search for the next usuable sign identifier
|
|
||||||
while (!found)
|
|
||||||
{
|
|
||||||
if (group == NULL)
|
|
||||||
id = next_sign_id++; // global group
|
|
||||||
else
|
|
||||||
id = group->next_sign_id++;
|
|
||||||
|
|
||||||
// Check whether this sign is already placed in the buffer
|
|
||||||
found = TRUE;
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
{
|
|
||||||
if (id == sign->id && sign_in_group(sign, groupname))
|
|
||||||
{
|
|
||||||
found = FALSE; // sign identifier is in use
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Insert a new sign into the signlist for buffer 'buf' between the 'prev' and
|
|
||||||
* 'next' signs.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
insert_sign(
|
|
||||||
buf_T *buf, // buffer to store sign in
|
|
||||||
signlist_T *prev, // previous sign entry
|
|
||||||
signlist_T *next, // next sign entry
|
|
||||||
int id, // sign ID
|
|
||||||
char_u *group, // sign group; NULL for global group
|
|
||||||
int prio, // sign priority
|
|
||||||
linenr_T lnum, // line number which gets the mark
|
|
||||||
int typenr) // typenr of sign we are adding
|
|
||||||
{
|
|
||||||
signlist_T *newsign;
|
|
||||||
|
|
||||||
newsign = (signlist_T *)lalloc_id((long_u)sizeof(signlist_T), FALSE,
|
|
||||||
aid_insert_sign);
|
|
||||||
if (newsign != NULL)
|
|
||||||
{
|
|
||||||
newsign->id = id;
|
|
||||||
newsign->lnum = lnum;
|
|
||||||
newsign->typenr = typenr;
|
|
||||||
if (group != NULL)
|
|
||||||
{
|
|
||||||
newsign->group = sign_group_ref(group);
|
|
||||||
if (newsign->group == NULL)
|
|
||||||
{
|
|
||||||
vim_free(newsign);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
newsign->group = NULL;
|
|
||||||
newsign->priority = prio;
|
|
||||||
newsign->next = next;
|
|
||||||
newsign->prev = prev;
|
|
||||||
if (next != NULL)
|
|
||||||
next->prev = newsign;
|
|
||||||
|
|
||||||
if (prev == NULL)
|
|
||||||
{
|
|
||||||
// When adding first sign need to redraw the windows to create the
|
|
||||||
// column for signs.
|
|
||||||
if (buf->b_signlist == NULL)
|
|
||||||
{
|
|
||||||
redraw_buf_later(buf, NOT_VALID);
|
|
||||||
changed_cline_bef_curs();
|
|
||||||
}
|
|
||||||
|
|
||||||
// first sign in signlist
|
|
||||||
buf->b_signlist = newsign;
|
|
||||||
#ifdef FEAT_NETBEANS_INTG
|
|
||||||
if (netbeans_active())
|
|
||||||
buf->b_has_sign_column = TRUE;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
prev->next = newsign;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Insert a new sign sorted by line number and sign priority.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
insert_sign_by_lnum_prio(
|
|
||||||
buf_T *buf, // buffer to store sign in
|
|
||||||
signlist_T *prev, // previous sign entry
|
|
||||||
int id, // sign ID
|
|
||||||
char_u *group, // sign group; NULL for global group
|
|
||||||
int prio, // sign priority
|
|
||||||
linenr_T lnum, // line number which gets the mark
|
|
||||||
int typenr) // typenr of sign we are adding
|
|
||||||
{
|
|
||||||
signlist_T *sign;
|
|
||||||
|
|
||||||
// keep signs sorted by lnum and by priority: insert new sign at
|
|
||||||
// the proper position in the list for this lnum.
|
|
||||||
while (prev != NULL && prev->lnum == lnum && prev->priority <= prio)
|
|
||||||
prev = prev->prev;
|
|
||||||
if (prev == NULL)
|
|
||||||
sign = buf->b_signlist;
|
|
||||||
else
|
|
||||||
sign = prev->next;
|
|
||||||
|
|
||||||
insert_sign(buf, prev, sign, id, group, prio, lnum, typenr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Returns TRUE if 'sign' is in 'group'.
|
|
||||||
* A sign can either be in the global group (sign->group == NULL)
|
|
||||||
* or in a named group. If 'group' is '*', then the sign is part of the group.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
sign_in_group(signlist_T *sign, char_u *group)
|
|
||||||
{
|
|
||||||
return ((group != NULL && STRCMP(group, "*") == 0)
|
|
||||||
|| (group == NULL && sign->group == NULL)
|
|
||||||
|| (group != NULL && sign->group != NULL
|
|
||||||
&& STRCMP(group, sign->group->sg_name) == 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return information about a sign in a Dict
|
|
||||||
*/
|
|
||||||
dict_T *
|
|
||||||
sign_get_info(signlist_T *sign)
|
|
||||||
{
|
|
||||||
dict_T *d;
|
|
||||||
|
|
||||||
if ((d = dict_alloc_id(aid_sign_getinfo)) == NULL)
|
|
||||||
return NULL;
|
|
||||||
dict_add_number(d, "id", sign->id);
|
|
||||||
dict_add_string(d, "group", (sign->group == NULL) ?
|
|
||||||
(char_u *)"" : sign->group->sg_name);
|
|
||||||
dict_add_number(d, "lnum", sign->lnum);
|
|
||||||
dict_add_string(d, "name", sign_typenr2name(sign->typenr));
|
|
||||||
dict_add_number(d, "priority", sign->priority);
|
|
||||||
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Add the sign into the signlist. Find the right spot to do it though.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
buf_addsign(
|
|
||||||
buf_T *buf, // buffer to store sign in
|
|
||||||
int id, // sign ID
|
|
||||||
char_u *groupname, // sign group
|
|
||||||
int prio, // sign priority
|
|
||||||
linenr_T lnum, // line number which gets the mark
|
|
||||||
int typenr) // typenr of sign we are adding
|
|
||||||
{
|
|
||||||
signlist_T *sign; // a sign in the signlist
|
|
||||||
signlist_T *prev; // the previous sign
|
|
||||||
|
|
||||||
prev = NULL;
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
{
|
|
||||||
if (lnum == sign->lnum && id == sign->id &&
|
|
||||||
sign_in_group(sign, groupname))
|
|
||||||
{
|
|
||||||
// Update an existing sign
|
|
||||||
sign->typenr = typenr;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (lnum < sign->lnum)
|
|
||||||
{
|
|
||||||
insert_sign_by_lnum_prio(buf, prev, id, groupname, prio,
|
|
||||||
lnum, typenr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
prev = sign;
|
|
||||||
}
|
|
||||||
|
|
||||||
insert_sign_by_lnum_prio(buf, prev, id, groupname, prio, lnum, typenr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For an existing, placed sign "markId" change the type to "typenr".
|
|
||||||
* Returns the line number of the sign, or zero if the sign is not found.
|
|
||||||
*/
|
|
||||||
linenr_T
|
|
||||||
buf_change_sign_type(
|
|
||||||
buf_T *buf, // buffer to store sign in
|
|
||||||
int markId, // sign ID
|
|
||||||
char_u *group, // sign group
|
|
||||||
int typenr) // typenr of sign we are adding
|
|
||||||
{
|
|
||||||
signlist_T *sign; // a sign in the signlist
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
{
|
|
||||||
if (sign->id == markId && sign_in_group(sign, group))
|
|
||||||
{
|
|
||||||
sign->typenr = typenr;
|
|
||||||
return sign->lnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return (linenr_T)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the type number of the sign at line number 'lnum' in buffer 'buf'
|
|
||||||
* which has the attribute specifed by 'type'. Returns 0 if a sign is not found
|
|
||||||
* at the line number or it doesn't have the specified attribute.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
buf_getsigntype(
|
|
||||||
buf_T *buf,
|
|
||||||
linenr_T lnum,
|
|
||||||
int type) /* SIGN_ICON, SIGN_TEXT, SIGN_ANY, SIGN_LINEHL */
|
|
||||||
{
|
|
||||||
signlist_T *sign; /* a sign in a b_signlist */
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
if (sign->lnum == lnum
|
|
||||||
&& (type == SIGN_ANY
|
|
||||||
# ifdef FEAT_SIGN_ICONS
|
|
||||||
|| (type == SIGN_ICON
|
|
||||||
&& sign_get_image(sign->typenr) != NULL)
|
|
||||||
# endif
|
|
||||||
|| (type == SIGN_TEXT
|
|
||||||
&& sign_get_text(sign->typenr) != NULL)
|
|
||||||
|| (type == SIGN_LINEHL
|
|
||||||
&& sign_get_attr(sign->typenr, TRUE) != 0)))
|
|
||||||
return sign->typenr;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Delete sign 'id' in group 'group' from buffer 'buf'.
|
|
||||||
* If 'id' is zero, then delete all the signs in group 'group'. Otherwise
|
|
||||||
* delete only the specified sign.
|
|
||||||
* If 'group' is '*', then delete the sign in all the groups. If 'group' is
|
|
||||||
* NULL, then delete the sign in the global group. Otherwise delete the sign in
|
|
||||||
* the specified group.
|
|
||||||
* Returns the line number of the deleted sign. If multiple signs are deleted,
|
|
||||||
* then returns the line number of the last sign deleted.
|
|
||||||
*/
|
|
||||||
linenr_T
|
|
||||||
buf_delsign(
|
|
||||||
buf_T *buf, // buffer sign is stored in
|
|
||||||
linenr_T atlnum, // sign at this line, 0 - at any line
|
|
||||||
int id, // sign id
|
|
||||||
char_u *group) // sign group
|
|
||||||
{
|
|
||||||
signlist_T **lastp; // pointer to pointer to current sign
|
|
||||||
signlist_T *sign; // a sign in a b_signlist
|
|
||||||
signlist_T *next; // the next sign in a b_signlist
|
|
||||||
linenr_T lnum; // line number whose sign was deleted
|
|
||||||
|
|
||||||
lastp = &buf->b_signlist;
|
|
||||||
lnum = 0;
|
|
||||||
for (sign = buf->b_signlist; sign != NULL; sign = next)
|
|
||||||
{
|
|
||||||
next = sign->next;
|
|
||||||
if ((id == 0 || sign->id == id) &&
|
|
||||||
(atlnum == 0 || sign->lnum == atlnum) &&
|
|
||||||
sign_in_group(sign, group))
|
|
||||||
|
|
||||||
{
|
|
||||||
*lastp = next;
|
|
||||||
if (next != NULL)
|
|
||||||
next->prev = sign->prev;
|
|
||||||
lnum = sign->lnum;
|
|
||||||
if (sign->group != NULL)
|
|
||||||
sign_group_unref(sign->group->sg_name);
|
|
||||||
vim_free(sign);
|
|
||||||
update_debug_sign(buf, lnum);
|
|
||||||
// Check whether only one sign needs to be deleted
|
|
||||||
// If deleting a sign with a specific identifer in a particular
|
|
||||||
// group or deleting any sign at a particular line number, delete
|
|
||||||
// only one sign.
|
|
||||||
if (group == NULL
|
|
||||||
|| (*group != '*' && id != 0)
|
|
||||||
|| (*group == '*' && atlnum != 0))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lastp = &sign->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
// When deleted the last sign need to redraw the windows to remove the
|
|
||||||
// sign column.
|
|
||||||
if (buf->b_signlist == NULL)
|
|
||||||
{
|
|
||||||
redraw_buf_later(buf, NOT_VALID);
|
|
||||||
changed_cline_bef_curs();
|
|
||||||
}
|
|
||||||
|
|
||||||
return lnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Find the line number of the sign with the requested id in group 'group'. If
|
|
||||||
* the sign does not exist, return 0 as the line number. This will still let
|
|
||||||
* the correct file get loaded.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
buf_findsign(
|
|
||||||
buf_T *buf, // buffer to store sign in
|
|
||||||
int id, // sign ID
|
|
||||||
char_u *group) // sign group
|
|
||||||
{
|
|
||||||
signlist_T *sign; // a sign in the signlist
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
if (sign->id == id && sign_in_group(sign, group))
|
|
||||||
return sign->lnum;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the sign at line 'lnum' in buffer 'buf'. Returns NULL if a sign is
|
|
||||||
* not found at the line. If 'groupname' is NULL, searches in the global group.
|
|
||||||
*/
|
|
||||||
static signlist_T *
|
|
||||||
buf_getsign_at_line(
|
|
||||||
buf_T *buf, // buffer whose sign we are searching for
|
|
||||||
linenr_T lnum, // line number of sign
|
|
||||||
char_u *groupname) // sign group name
|
|
||||||
{
|
|
||||||
signlist_T *sign; // a sign in the signlist
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
if (sign->lnum == lnum && sign_in_group(sign, groupname))
|
|
||||||
return sign;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the sign with identifier 'id' in group 'group' placed in buffer 'buf'
|
|
||||||
*/
|
|
||||||
signlist_T *
|
|
||||||
buf_getsign_with_id(
|
|
||||||
buf_T *buf, // buffer whose sign we are searching for
|
|
||||||
int id, // sign identifier
|
|
||||||
char_u *group) // sign group
|
|
||||||
{
|
|
||||||
signlist_T *sign; // a sign in the signlist
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
if (sign->id == id && sign_in_group(sign, group))
|
|
||||||
return sign;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return the identifier of the sign at line number 'lnum' in buffer 'buf'.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
buf_findsign_id(
|
|
||||||
buf_T *buf, // buffer whose sign we are searching for
|
|
||||||
linenr_T lnum, // line number of sign
|
|
||||||
char_u *groupname) // sign group name
|
|
||||||
{
|
|
||||||
signlist_T *sign; // a sign in the signlist
|
|
||||||
|
|
||||||
sign = buf_getsign_at_line(buf, lnum, groupname);
|
|
||||||
if (sign != NULL)
|
|
||||||
return sign->id;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
# if defined(FEAT_NETBEANS_INTG) || defined(PROTO)
|
|
||||||
/*
|
|
||||||
* See if a given type of sign exists on a specific line.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
buf_findsigntype_id(
|
|
||||||
buf_T *buf, /* buffer whose sign we are searching for */
|
|
||||||
linenr_T lnum, /* line number of sign */
|
|
||||||
int typenr) /* sign type number */
|
|
||||||
{
|
|
||||||
signlist_T *sign; /* a sign in the signlist */
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
if (sign->lnum == lnum && sign->typenr == typenr)
|
|
||||||
return sign->id;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# if defined(FEAT_SIGN_ICONS) || defined(PROTO)
|
|
||||||
/*
|
|
||||||
* Return the number of icons on the given line.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
buf_signcount(buf_T *buf, linenr_T lnum)
|
|
||||||
{
|
|
||||||
signlist_T *sign; // a sign in the signlist
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
if (sign->lnum == lnum)
|
|
||||||
if (sign_get_image(sign->typenr) != NULL)
|
|
||||||
count++;
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
# endif /* FEAT_SIGN_ICONS */
|
|
||||||
# endif /* FEAT_NETBEANS_INTG */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Delete signs in group 'group' in buffer "buf". If 'group' is '*', then
|
|
||||||
* delete all the signs.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
buf_delete_signs(buf_T *buf, char_u *group)
|
|
||||||
{
|
|
||||||
signlist_T *sign;
|
|
||||||
signlist_T **lastp; // pointer to pointer to current sign
|
|
||||||
signlist_T *next;
|
|
||||||
|
|
||||||
// When deleting the last sign need to redraw the windows to remove the
|
|
||||||
// sign column. Not when curwin is NULL (this means we're exiting).
|
|
||||||
if (buf->b_signlist != NULL && curwin != NULL)
|
|
||||||
{
|
|
||||||
redraw_buf_later(buf, NOT_VALID);
|
|
||||||
changed_cline_bef_curs();
|
|
||||||
}
|
|
||||||
|
|
||||||
lastp = &buf->b_signlist;
|
|
||||||
for (sign = buf->b_signlist; sign != NULL; sign = next)
|
|
||||||
{
|
|
||||||
next = sign->next;
|
|
||||||
if (sign_in_group(sign, group))
|
|
||||||
{
|
|
||||||
*lastp = next;
|
|
||||||
if (next != NULL)
|
|
||||||
next->prev = sign->prev;
|
|
||||||
if (sign->group != NULL)
|
|
||||||
sign_group_unref(sign->group->sg_name);
|
|
||||||
vim_free(sign);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
lastp = &sign->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Delete all the signs in the specified group in all the buffers.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
buf_delete_all_signs(char_u *groupname)
|
|
||||||
{
|
|
||||||
buf_T *buf; /* buffer we are checking for signs */
|
|
||||||
|
|
||||||
FOR_ALL_BUFFERS(buf)
|
|
||||||
if (buf->b_signlist != NULL)
|
|
||||||
buf_delete_signs(buf, groupname);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* List placed signs for "rbuf". If "rbuf" is NULL do it for all buffers.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
sign_list_placed(buf_T *rbuf, char_u *sign_group)
|
|
||||||
{
|
|
||||||
buf_T *buf;
|
|
||||||
signlist_T *sign;
|
|
||||||
char lbuf[BUFSIZ];
|
|
||||||
char group[BUFSIZ];
|
|
||||||
|
|
||||||
MSG_PUTS_TITLE(_("\n--- Signs ---"));
|
|
||||||
msg_putchar('\n');
|
|
||||||
if (rbuf == NULL)
|
|
||||||
buf = firstbuf;
|
|
||||||
else
|
|
||||||
buf = rbuf;
|
|
||||||
while (buf != NULL && !got_int)
|
|
||||||
{
|
|
||||||
if (buf->b_signlist != NULL)
|
|
||||||
{
|
|
||||||
vim_snprintf(lbuf, BUFSIZ, _("Signs for %s:"), buf->b_fname);
|
|
||||||
MSG_PUTS_ATTR(lbuf, HL_ATTR(HLF_D));
|
|
||||||
msg_putchar('\n');
|
|
||||||
}
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
{
|
|
||||||
if (got_int)
|
|
||||||
break;
|
|
||||||
if (!sign_in_group(sign, sign_group))
|
|
||||||
continue;
|
|
||||||
if (sign->group != NULL)
|
|
||||||
vim_snprintf(group, BUFSIZ, " group=%s",
|
|
||||||
sign->group->sg_name);
|
|
||||||
else
|
|
||||||
group[0] = '\0';
|
|
||||||
vim_snprintf(lbuf, BUFSIZ, _(" line=%ld id=%d%s name=%s "
|
|
||||||
"priority=%d"),
|
|
||||||
(long)sign->lnum, sign->id, group,
|
|
||||||
sign_typenr2name(sign->typenr), sign->priority);
|
|
||||||
MSG_PUTS(lbuf);
|
|
||||||
msg_putchar('\n');
|
|
||||||
}
|
|
||||||
if (rbuf != NULL)
|
|
||||||
break;
|
|
||||||
buf = buf->b_next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Adjust a placed sign for inserted/deleted lines.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
sign_mark_adjust(
|
|
||||||
linenr_T line1,
|
|
||||||
linenr_T line2,
|
|
||||||
long amount,
|
|
||||||
long amount_after)
|
|
||||||
{
|
|
||||||
signlist_T *sign; /* a sign in a b_signlist */
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(curbuf, sign)
|
|
||||||
{
|
|
||||||
if (sign->lnum >= line1 && sign->lnum <= line2)
|
|
||||||
{
|
|
||||||
if (amount == MAXLNUM)
|
|
||||||
sign->lnum = line1;
|
|
||||||
else
|
|
||||||
sign->lnum += amount;
|
|
||||||
}
|
|
||||||
else if (sign->lnum > line2)
|
|
||||||
sign->lnum += amount_after;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* FEAT_SIGNS */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set 'buflisted' for curbuf to "on" and trigger autocommands if it changed.
|
* Set 'buflisted' for curbuf to "on" and trigger autocommands if it changed.
|
||||||
*/
|
*/
|
||||||
|
@@ -4424,24 +4424,6 @@ f_get(typval_T *argvars, typval_T *rettv)
|
|||||||
copy_tv(tv, rettv);
|
copy_tv(tv, rettv);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_SIGNS
|
|
||||||
/*
|
|
||||||
* Returns information about signs placed in a buffer as list of dicts.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
get_buffer_signs(buf_T *buf, list_T *l)
|
|
||||||
{
|
|
||||||
signlist_T *sign;
|
|
||||||
dict_T *d;
|
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign)
|
|
||||||
{
|
|
||||||
if ((d = sign_get_info(sign)) != NULL)
|
|
||||||
list_append_dict(l, d);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns buffer options, variables and other attributes in a dictionary.
|
* Returns buffer options, variables and other attributes in a dictionary.
|
||||||
*/
|
*/
|
||||||
|
1246
src/ex_cmds.c
1246
src/ex_cmds.c
File diff suppressed because it is too large
Load Diff
@@ -172,6 +172,9 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void
|
|||||||
# include "sha256.pro"
|
# include "sha256.pro"
|
||||||
# endif
|
# endif
|
||||||
# include "search.pro"
|
# include "search.pro"
|
||||||
|
# ifdef FEAT_SIGNS
|
||||||
|
# include "sign.pro"
|
||||||
|
# endif
|
||||||
# include "spell.pro"
|
# include "spell.pro"
|
||||||
# include "spellfile.pro"
|
# include "spellfile.pro"
|
||||||
# include "syntax.pro"
|
# include "syntax.pro"
|
||||||
|
@@ -69,23 +69,6 @@ char_u *buf_spname(buf_T *buf);
|
|||||||
void switch_to_win_for_buf(buf_T *buf, win_T **save_curwinp, tabpage_T **save_curtabp, bufref_T *save_curbuf);
|
void switch_to_win_for_buf(buf_T *buf, win_T **save_curwinp, tabpage_T **save_curtabp, bufref_T *save_curbuf);
|
||||||
void restore_win_for_buf(win_T *save_curwin, tabpage_T *save_curtab, bufref_T *save_curbuf);
|
void restore_win_for_buf(win_T *save_curwin, tabpage_T *save_curtab, bufref_T *save_curbuf);
|
||||||
int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp);
|
int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp);
|
||||||
void init_signs(void);
|
|
||||||
int sign_group_get_next_signid(buf_T *buf, char_u *groupname);
|
|
||||||
int sign_in_group(signlist_T *sign, char_u *group);
|
|
||||||
dict_T *sign_get_info(signlist_T *sign);
|
|
||||||
void buf_addsign(buf_T *buf, int id, char_u *groupname, int prio, linenr_T lnum, int typenr);
|
|
||||||
linenr_T buf_change_sign_type(buf_T *buf, int markId, char_u *group, int typenr);
|
|
||||||
int buf_getsigntype(buf_T *buf, linenr_T lnum, int type);
|
|
||||||
linenr_T buf_delsign(buf_T *buf, linenr_T atlnum, int id, char_u *group);
|
|
||||||
int buf_findsign(buf_T *buf, int id, char_u *group);
|
|
||||||
signlist_T *buf_getsign_with_id(buf_T *buf, int id, char_u *group);
|
|
||||||
int buf_findsign_id(buf_T *buf, linenr_T lnum, char_u *groupname);
|
|
||||||
int buf_findsigntype_id(buf_T *buf, linenr_T lnum, int typenr);
|
|
||||||
int buf_signcount(buf_T *buf, linenr_T lnum);
|
|
||||||
void buf_delete_signs(buf_T *buf, char_u *group);
|
|
||||||
void buf_delete_all_signs(char_u *groupname);
|
|
||||||
void sign_list_placed(buf_T *rbuf, char_u *sign_group);
|
|
||||||
void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after);
|
|
||||||
void set_buflisted(int on);
|
void set_buflisted(int on);
|
||||||
int buf_contents_changed(buf_T *buf);
|
int buf_contents_changed(buf_T *buf);
|
||||||
void wipe_buffer(buf_T *buf, int aucmd);
|
void wipe_buffer(buf_T *buf, int aucmd);
|
||||||
|
@@ -54,21 +54,6 @@ void fix_help_buffer(void);
|
|||||||
void ex_exusage(exarg_T *eap);
|
void ex_exusage(exarg_T *eap);
|
||||||
void ex_viusage(exarg_T *eap);
|
void ex_viusage(exarg_T *eap);
|
||||||
void ex_helptags(exarg_T *eap);
|
void ex_helptags(exarg_T *eap);
|
||||||
int sign_define_by_name(char_u *name, char_u *icon, char_u *linehl, char_u *text, char_u *texthl);
|
|
||||||
int sign_undefine_by_name(char_u *name);
|
|
||||||
int sign_place(int *sign_id, char_u *sign_group, char_u *sign_name, buf_T *buf, linenr_T lnum, int prio);
|
|
||||||
int sign_unplace(int sign_id, char_u *sign_group, buf_T *buf, linenr_T atlnum);
|
|
||||||
void ex_sign(exarg_T *eap);
|
|
||||||
void sign_getlist(char_u *name, list_T *retlist);
|
|
||||||
void sign_get_placed(buf_T *buf, linenr_T lnum, int sign_id, char_u *sign_group, list_T *retlist);
|
|
||||||
void sign_gui_started(void);
|
|
||||||
int sign_get_attr(int typenr, int line);
|
|
||||||
char_u *sign_get_text(int typenr);
|
|
||||||
void *sign_get_image(int typenr);
|
|
||||||
char_u *sign_typenr2name(int typenr);
|
|
||||||
void free_signs(void);
|
|
||||||
char_u *get_sign_name(expand_T *xp, int idx);
|
|
||||||
void set_context_in_sign_cmd(expand_T *xp, char_u *arg);
|
|
||||||
void ex_smile(exarg_T *eap);
|
void ex_smile(exarg_T *eap);
|
||||||
void ex_drop(exarg_T *eap);
|
void ex_drop(exarg_T *eap);
|
||||||
char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags);
|
char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags);
|
||||||
|
25
src/proto/sign.pro
Normal file
25
src/proto/sign.pro
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/* sign.c */
|
||||||
|
void init_signs(void);
|
||||||
|
int buf_getsigntype(buf_T *buf, linenr_T lnum, int type);
|
||||||
|
linenr_T buf_delsign(buf_T *buf, linenr_T atlnum, int id, char_u *group);
|
||||||
|
int buf_findsign(buf_T *buf, int id, char_u *group);
|
||||||
|
int buf_findsign_id(buf_T *buf, linenr_T lnum, char_u *groupname);
|
||||||
|
int buf_findsigntype_id(buf_T *buf, linenr_T lnum, int typenr);
|
||||||
|
int buf_signcount(buf_T *buf, linenr_T lnum);
|
||||||
|
void buf_delete_signs(buf_T *buf, char_u *group);
|
||||||
|
void sign_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after);
|
||||||
|
int sign_define_by_name(char_u *name, char_u *icon, char_u *linehl, char_u *text, char_u *texthl);
|
||||||
|
int sign_undefine_by_name(char_u *name);
|
||||||
|
int sign_place(int *sign_id, char_u *sign_group, char_u *sign_name, buf_T *buf, linenr_T lnum, int prio);
|
||||||
|
int sign_unplace(int sign_id, char_u *sign_group, buf_T *buf, linenr_T atlnum);
|
||||||
|
void ex_sign(exarg_T *eap);
|
||||||
|
void sign_getlist(char_u *name, list_T *retlist);
|
||||||
|
void get_buffer_signs(buf_T *buf, list_T *l);
|
||||||
|
void sign_get_placed(buf_T *buf, linenr_T lnum, int sign_id, char_u *sign_group, list_T *retlist);
|
||||||
|
void sign_gui_started(void);
|
||||||
|
int sign_get_attr(int typenr, int line);
|
||||||
|
char_u *sign_get_text(int typenr);
|
||||||
|
void *sign_get_image(int typenr);
|
||||||
|
void free_signs(void);
|
||||||
|
char_u *get_sign_name(expand_T *xp, int idx);
|
||||||
|
void set_context_in_sign_cmd(expand_T *xp, char_u *arg);
|
1880
src/sign.c
Normal file
1880
src/sign.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -799,6 +799,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
673,
|
||||||
/**/
|
/**/
|
||||||
672,
|
672,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user