Mercurial > vim
comparison src/syntax.c @ 448:dd9db57ee7ce v7.0118
updated for version 7.0118
author | vimboss |
---|---|
date | Thu, 28 Jul 2005 22:36:45 +0000 |
parents | c36697964844 |
children | a5fcf36ef512 |
comparison
equal
deleted
inserted
replaced
447:8347d456f7e5 | 448:dd9db57ee7ce |
---|---|
49 char_u *sg_font_name; /* GUI font or fontset name */ | 49 char_u *sg_font_name; /* GUI font or fontset name */ |
50 int sg_gui_attr; /* Screen attr for GUI mode */ | 50 int sg_gui_attr; /* Screen attr for GUI mode */ |
51 #endif | 51 #endif |
52 int sg_link; /* link to this highlight group ID */ | 52 int sg_link; /* link to this highlight group ID */ |
53 int sg_set; /* combination of SG_* flags */ | 53 int sg_set; /* combination of SG_* flags */ |
54 #ifdef FEAT_EVAL | |
55 scid_T sg_scriptID; /* script in which the group was last set */ | |
56 #endif | |
54 }; | 57 }; |
55 | 58 |
56 #define SG_TERM 1 /* term has been set */ | 59 #define SG_TERM 1 /* term has been set */ |
57 #define SG_CTERM 2 /* cterm has been set */ | 60 #define SG_CTERM 2 /* cterm has been set */ |
58 #define SG_GUI 4 /* gui has been set */ | 61 #define SG_GUI 4 /* gui has been set */ |
6350 else | 6353 else |
6351 { | 6354 { |
6352 if (!init) | 6355 if (!init) |
6353 HL_TABLE()[from_id - 1].sg_set |= SG_LINK; | 6356 HL_TABLE()[from_id - 1].sg_set |= SG_LINK; |
6354 HL_TABLE()[from_id - 1].sg_link = to_id; | 6357 HL_TABLE()[from_id - 1].sg_link = to_id; |
6358 #ifdef FEAT_EVAL | |
6359 HL_TABLE()[from_id - 1].sg_scriptID = current_SID; | |
6360 #endif | |
6355 redraw_all_later(NOT_VALID); | 6361 redraw_all_later(NOT_VALID); |
6356 } | 6362 } |
6357 } | 6363 } |
6358 | 6364 |
6359 /* Only call highlight_changed() once, after sourcing a syntax file */ | 6365 /* Only call highlight_changed() once, after sourcing a syntax file */ |
7099 } | 7105 } |
7100 # endif | 7106 # endif |
7101 #endif | 7107 #endif |
7102 else | 7108 else |
7103 set_hl_attr(idx); | 7109 set_hl_attr(idx); |
7110 #ifdef FEAT_EVAL | |
7111 HL_TABLE()[idx].sg_scriptID = current_SID; | |
7112 #endif | |
7104 redraw_all_later(NOT_VALID); | 7113 redraw_all_later(NOT_VALID); |
7105 } | 7114 } |
7106 vim_free(key); | 7115 vim_free(key); |
7107 vim_free(arg); | 7116 vim_free(arg); |
7108 | 7117 |
7198 HL_TABLE()[idx].sg_fontset = NOFONTSET; | 7207 HL_TABLE()[idx].sg_fontset = NOFONTSET; |
7199 # endif | 7208 # endif |
7200 vim_free(HL_TABLE()[idx].sg_font_name); | 7209 vim_free(HL_TABLE()[idx].sg_font_name); |
7201 HL_TABLE()[idx].sg_font_name = NULL; | 7210 HL_TABLE()[idx].sg_font_name = NULL; |
7202 HL_TABLE()[idx].sg_gui_attr = 0; | 7211 HL_TABLE()[idx].sg_gui_attr = 0; |
7212 #endif | |
7213 #ifdef FEAT_EVAL | |
7214 /* Clear the script ID only when there is no link, since that is not | |
7215 * cleared. */ | |
7216 if (HL_TABLE()[idx].sg_link == 0) | |
7217 HL_TABLE()[idx].sg_scriptID = 0; | |
7203 #endif | 7218 #endif |
7204 } | 7219 } |
7205 | 7220 |
7206 #if defined(FEAT_GUI) || defined(PROTO) | 7221 #if defined(FEAT_GUI) || defined(PROTO) |
7207 /* | 7222 /* |
7866 0, sgp->sg_gui_sp_name, "guisp"); | 7881 0, sgp->sg_gui_sp_name, "guisp"); |
7867 didh = highlight_list_arg(id, didh, LIST_STRING, | 7882 didh = highlight_list_arg(id, didh, LIST_STRING, |
7868 0, sgp->sg_font_name, "font"); | 7883 0, sgp->sg_font_name, "font"); |
7869 #endif | 7884 #endif |
7870 | 7885 |
7871 if (sgp->sg_link) | 7886 if (sgp->sg_link && !got_int) |
7872 { | 7887 { |
7873 (void)syn_list_header(didh, 9999, id); | 7888 (void)syn_list_header(didh, 9999, id); |
7889 didh = TRUE; | |
7874 msg_puts_attr((char_u *)"links to", hl_attr(HLF_D)); | 7890 msg_puts_attr((char_u *)"links to", hl_attr(HLF_D)); |
7875 msg_putchar(' '); | 7891 msg_putchar(' '); |
7876 msg_outtrans(HL_TABLE()[HL_TABLE()[id - 1].sg_link - 1].sg_name); | 7892 msg_outtrans(HL_TABLE()[HL_TABLE()[id - 1].sg_link - 1].sg_name); |
7877 } | 7893 } |
7894 | |
7895 #ifdef FEAT_EVAL | |
7896 if (didh && p_verbose > 0) | |
7897 last_set_msg(sgp->sg_scriptID); | |
7898 #endif | |
7878 } | 7899 } |
7879 | 7900 |
7880 static int | 7901 static int |
7881 highlight_list_arg(id, didh, type, iarg, sarg, name) | 7902 highlight_list_arg(id, didh, type, iarg, sarg, name) |
7882 int id; | 7903 int id; |
7888 { | 7909 { |
7889 char_u buf[100]; | 7910 char_u buf[100]; |
7890 char_u *ts; | 7911 char_u *ts; |
7891 int i; | 7912 int i; |
7892 | 7913 |
7914 if (got_int) | |
7915 return FALSE; | |
7893 if (type == LIST_STRING ? (sarg != NULL) : (iarg != 0)) | 7916 if (type == LIST_STRING ? (sarg != NULL) : (iarg != 0)) |
7894 { | 7917 { |
7895 ts = buf; | 7918 ts = buf; |
7896 if (type == LIST_INT) | 7919 if (type == LIST_INT) |
7897 sprintf((char *)buf, "%d", iarg - 1); | 7920 sprintf((char *)buf, "%d", iarg - 1); |
7913 } | 7936 } |
7914 | 7937 |
7915 (void)syn_list_header(didh, | 7938 (void)syn_list_header(didh, |
7916 (int)(vim_strsize(ts) + STRLEN(name) + 1), id); | 7939 (int)(vim_strsize(ts) + STRLEN(name) + 1), id); |
7917 didh = TRUE; | 7940 didh = TRUE; |
7918 | 7941 if (!got_int) |
7919 MSG_PUTS_ATTR(name, hl_attr(HLF_D)); | 7942 { |
7920 MSG_PUTS_ATTR("=", hl_attr(HLF_D)); | 7943 MSG_PUTS_ATTR(name, hl_attr(HLF_D)); |
7921 msg_outtrans(ts); | 7944 MSG_PUTS_ATTR("=", hl_attr(HLF_D)); |
7945 msg_outtrans(ts); | |
7946 } | |
7922 } | 7947 } |
7923 return didh; | 7948 return didh; |
7924 } | 7949 } |
7925 | 7950 |
7926 #if (((defined(FEAT_EVAL) || defined(FEAT_PRINTER))) && defined(FEAT_SYN_HL)) || defined(PROTO) | 7951 #if (((defined(FEAT_EVAL) || defined(FEAT_PRINTER))) && defined(FEAT_SYN_HL)) || defined(PROTO) |
8066 int newline = TRUE; | 8091 int newline = TRUE; |
8067 | 8092 |
8068 if (!did_header) | 8093 if (!did_header) |
8069 { | 8094 { |
8070 msg_putchar('\n'); | 8095 msg_putchar('\n'); |
8096 if (got_int) | |
8097 return TRUE; | |
8071 msg_outtrans(HL_TABLE()[id - 1].sg_name); | 8098 msg_outtrans(HL_TABLE()[id - 1].sg_name); |
8072 endcol = 15; | 8099 endcol = 15; |
8073 } | 8100 } |
8074 else if (msg_col + outlen + 1 >= Columns) | 8101 else if (msg_col + outlen + 1 >= Columns) |
8102 { | |
8075 msg_putchar('\n'); | 8103 msg_putchar('\n'); |
8104 if (got_int) | |
8105 return TRUE; | |
8106 } | |
8076 else | 8107 else |
8077 { | 8108 { |
8078 if (msg_col >= endcol) /* wrap around is like starting a new line */ | 8109 if (msg_col >= endcol) /* wrap around is like starting a new line */ |
8079 newline = FALSE; | 8110 newline = FALSE; |
8080 } | 8111 } |