Mercurial > vim
comparison src/highlight.c @ 20116:513c62184ed8 v8.2.0613
patch 8.2.0613: Vim9: no check for space before #comment
Commit: https://github.com/vim/vim/commit/1966c248814d5195edcd1208ed0e51e664a61283
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Apr 20 22:42:32 2020 +0200
patch 8.2.0613: Vim9: no check for space before #comment
Problem: Vim9: no check for space before #comment.
Solution: Add space checks.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 20 Apr 2020 22:45:04 +0200 |
parents | 2c23053c654a |
children | 1acf700beb9c |
comparison
equal
deleted
inserted
replaced
20115:bd021eb62e73 | 20116:513c62184ed8 |
---|---|
692 dolink = TRUE; | 692 dolink = TRUE; |
693 | 693 |
694 /* | 694 /* |
695 * ":highlight {group-name}": list highlighting for one group. | 695 * ":highlight {group-name}": list highlighting for one group. |
696 */ | 696 */ |
697 if (!doclear && !dolink && ends_excmd(*linep)) | 697 if (!doclear && !dolink && ends_excmd2(line, linep)) |
698 { | 698 { |
699 id = syn_namen2id(line, (int)(name_end - line)); | 699 id = syn_namen2id(line, (int)(name_end - line)); |
700 if (id == 0) | 700 if (id == 0) |
701 semsg(_("E411: highlight group not found: %s"), line); | 701 semsg(_("E411: highlight group not found: %s"), line); |
702 else | 702 else |
718 | 718 |
719 from_end = skiptowhite(from_start); | 719 from_end = skiptowhite(from_start); |
720 to_start = skipwhite(from_end); | 720 to_start = skipwhite(from_end); |
721 to_end = skiptowhite(to_start); | 721 to_end = skiptowhite(to_start); |
722 | 722 |
723 if (ends_excmd(*from_start) || ends_excmd(*to_start)) | 723 if (ends_excmd2(line, from_start) || ends_excmd2(line, to_start)) |
724 { | 724 { |
725 semsg(_("E412: Not enough arguments: \":highlight link %s\""), | 725 semsg(_("E412: Not enough arguments: \":highlight link %s\""), |
726 from_start); | 726 from_start); |
727 return; | 727 return; |
728 } | 728 } |
729 | 729 |
730 if (!ends_excmd(*skipwhite(to_end))) | 730 if (!ends_excmd2(line, skipwhite(to_end))) |
731 { | 731 { |
732 semsg(_("E413: Too many arguments: \":highlight link %s\""), from_start); | 732 semsg(_("E413: Too many arguments: \":highlight link %s\""), from_start); |
733 return; | 733 return; |
734 } | 734 } |
735 | 735 |
779 if (doclear) | 779 if (doclear) |
780 { | 780 { |
781 /* | 781 /* |
782 * ":highlight clear [group]" command. | 782 * ":highlight clear [group]" command. |
783 */ | 783 */ |
784 line = linep; | 784 if (ends_excmd2(line, linep)) |
785 if (ends_excmd(*line)) | |
786 { | 785 { |
787 #ifdef FEAT_GUI | 786 #ifdef FEAT_GUI |
788 // First, we do not destroy the old values, but allocate the new | 787 // First, we do not destroy the old values, but allocate the new |
789 // ones and update the display. THEN we destroy the old values. | 788 // ones and update the display. THEN we destroy the old values. |
790 // If we destroy the old values first, then the old values | 789 // If we destroy the old values first, then the old values |
824 // Ok, we're done allocating the new default graphics items. | 823 // Ok, we're done allocating the new default graphics items. |
825 // The screen should already be refreshed at this point. | 824 // The screen should already be refreshed at this point. |
826 // It is now Ok to clear out the old data. | 825 // It is now Ok to clear out the old data. |
827 #endif | 826 #endif |
828 #ifdef FEAT_EVAL | 827 #ifdef FEAT_EVAL |
829 do_unlet((char_u *)"colors_name", TRUE); | 828 do_unlet((char_u *)"g:colors_name", TRUE); |
830 #endif | 829 #endif |
831 restore_cterm_colors(); | 830 restore_cterm_colors(); |
832 | 831 |
833 /* | 832 /* |
834 * Clear all default highlight groups and load the defaults. | 833 * Clear all default highlight groups and load the defaults. |
843 #endif | 842 #endif |
844 highlight_changed(); | 843 highlight_changed(); |
845 redraw_later_clear(); | 844 redraw_later_clear(); |
846 return; | 845 return; |
847 } | 846 } |
847 line = linep; | |
848 name_end = skiptowhite(line); | 848 name_end = skiptowhite(line); |
849 linep = skipwhite(name_end); | 849 linep = skipwhite(name_end); |
850 } | 850 } |
851 | 851 |
852 /* | 852 /* |
886 if (!doclear) | 886 if (!doclear) |
887 HL_TABLE()[idx].sg_set = 0; | 887 HL_TABLE()[idx].sg_set = 0; |
888 } | 888 } |
889 | 889 |
890 if (!doclear) | 890 if (!doclear) |
891 while (!ends_excmd(*linep)) | 891 while (!ends_excmd2(line, linep)) |
892 { | 892 { |
893 key_start = linep; | 893 key_start = linep; |
894 if (*linep == '=') | 894 if (*linep == '=') |
895 { | 895 { |
896 semsg(_("E415: unexpected equal sign: %s"), key_start); | 896 semsg(_("E415: unexpected equal sign: %s"), key_start); |
4944 | 4944 |
4945 // First clear any old pattern. | 4945 // First clear any old pattern. |
4946 if (!eap->skip) | 4946 if (!eap->skip) |
4947 match_delete(curwin, id, FALSE); | 4947 match_delete(curwin, id, FALSE); |
4948 | 4948 |
4949 if (ends_excmd(*eap->arg)) | 4949 if (ends_excmd2(eap->cmd, eap->arg)) |
4950 end = eap->arg; | 4950 end = eap->arg; |
4951 else if ((STRNICMP(eap->arg, "none", 4) == 0 | 4951 else if ((STRNICMP(eap->arg, "none", 4) == 0 |
4952 && (VIM_ISWHITE(eap->arg[4]) || ends_excmd(eap->arg[4])))) | 4952 && (VIM_ISWHITE(eap->arg[4]) |
4953 || ends_excmd2(eap->arg, eap->arg + 4)))) | |
4953 end = eap->arg + 4; | 4954 end = eap->arg + 4; |
4954 else | 4955 else |
4955 { | 4956 { |
4956 p = skiptowhite(eap->arg); | 4957 p = skiptowhite(eap->arg); |
4957 if (!eap->skip) | 4958 if (!eap->skip) |
4965 return; | 4966 return; |
4966 } | 4967 } |
4967 end = skip_regexp(p + 1, *p, TRUE); | 4968 end = skip_regexp(p + 1, *p, TRUE); |
4968 if (!eap->skip) | 4969 if (!eap->skip) |
4969 { | 4970 { |
4970 if (*end != NUL && !ends_excmd(*skipwhite(end + 1))) | 4971 if (*end != NUL && !ends_excmd2(end, skipwhite(end + 1))) |
4971 { | 4972 { |
4972 vim_free(g); | 4973 vim_free(g); |
4973 eap->errmsg = e_trailing; | 4974 eap->errmsg = e_trailing; |
4974 return; | 4975 return; |
4975 } | 4976 } |