@@ -188,15 +188,15 @@ bool bReplace = false;
188
188
189
189
t_regexp * regexp = NULL ;
190
190
191
- CString strRegexp;
191
+ CString strRegexp;
192
192
193
193
if (Flags & eTriggerRegularExpression)
194
194
strRegexp = MatchText;
195
195
else
196
196
strRegexp = ConvertToRegularExpression (MatchText);
197
197
198
198
// compile regular expression
199
- try
199
+ try
200
200
{
201
201
regexp = regcomp (strRegexp, (Flags & eIgnoreCase ? PCRE_CASELESS : 0 ) | (m_bUTF_8 ? PCRE_UTF8 : 0 ));
202
202
} // end of try
@@ -752,6 +752,46 @@ bool bChanged;
752
752
if (TriggerOptionsTable [iItem].iFlags & OPT_CANNOT_WRITE)
753
753
return ePluginCannotSetOption; // not available for writing at all
754
754
755
+ // ------ preliminary validation before setting the option
756
+
757
+ if (strOptionName == " multi_line" ||
758
+ strOptionName == " ignore_case" )
759
+ {
760
+ t_regexp * regexp = NULL ;
761
+
762
+ CString strRegexp;
763
+
764
+ if (trigger_item->bRegexp )
765
+ strRegexp = trigger_item->trigger ;
766
+ else
767
+ strRegexp = ConvertToRegularExpression (trigger_item->trigger );
768
+
769
+ // compile regular expression
770
+ try
771
+ {
772
+ // use new options as appropriate
773
+ unsigned short bMultiLine = trigger_item->bMultiLine ;
774
+ if (strOptionName == " multi_line" )
775
+ bMultiLine = iValue;
776
+ unsigned short bIgnoreCase = trigger_item->ignore_case ;
777
+ if (strOptionName == " ignore_case" )
778
+ bIgnoreCase = iValue;
779
+
780
+ regexp = regcomp (strRegexp, (bIgnoreCase ? PCRE_CASELESS : 0 ) |
781
+ (bMultiLine ? PCRE_MULTILINE : 0 ) |
782
+ (m_bUTF_8 ? PCRE_UTF8 : 0 )
783
+ );
784
+ } // end of try
785
+ catch (CException* e)
786
+ {
787
+ e->Delete ();
788
+ return eBadRegularExpression;
789
+ } // end of catch
790
+
791
+ delete trigger_item->regexp ; // get rid of old one
792
+ trigger_item->regexp = regexp;
793
+ } // end of option multi_line or ignore_case
794
+
755
795
iResult = SetBaseOptionItem (iItem,
756
796
TriggerOptionsTable,
757
797
NUMITEMS (TriggerOptionsTable),
@@ -790,9 +830,7 @@ bool bChanged;
790
830
// ------ preliminary validation before setting the option
791
831
792
832
// cannot have null match text
793
- if (strOptionName == " match" ||
794
- strOptionName == " ignore_case" ||
795
- strOptionName == " multi_line" )
833
+ if (strOptionName == " match" )
796
834
{
797
835
if (strValue.IsEmpty ())
798
836
return eTriggerCannotBeEmpty;
0 commit comments