From a91ba088abf7b21f640f671ad7f211c0957b4765 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 4 Dec 2022 08:38:38 +0800 Subject: vim-patch:8.2.2182: Vim9: value of 'magic' is still relevant Problem: Vim9: value of 'magic' is still relevant. Solution: Always behave like 'magic' is on in Vim9 script (closes vim/vim#7509) https://github.com/vim/vim/commit/f4e2099e39ed4d71aed0f9a9579455aed5ec6cc2 EX_NONWHITE_OK is N/A: only applies to Vim9 script. Co-authored-by: Bram Moolenaar --- src/nvim/regexp_defs.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/nvim/regexp_defs.h') diff --git a/src/nvim/regexp_defs.h b/src/nvim/regexp_defs.h index a3b77f295a..3b94723d4f 100644 --- a/src/nvim/regexp_defs.h +++ b/src/nvim/regexp_defs.h @@ -15,6 +15,12 @@ #include "nvim/pos.h" #include "nvim/types.h" +typedef enum { + MAGIC_NOT_SET, ///< p_magic not overruled + MAGIC_ON, ///< magic on inside regexp + MAGIC_OFF, ///< magic off inside regexp +} magic_T; + // The number of sub-matches is limited to 10. // The first one (index 0) is the whole match, referenced with "\0". // The second one (index 1) is the first sub-match, referenced with "\1". -- cgit From 46e4be0fd0002233bde613295607ce5eeb498567 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 4 Dec 2022 09:09:00 +0800 Subject: vim-patch:8.2.2295: incsearch does not detect empty pattern properly Problem: Incsearch does not detect empty pattern properly. Solution: Return magic state when skipping over a pattern. (Christian Brabandt, closes vim/vim#7612, closes vim/vim#6420) https://github.com/vim/vim/commit/d93a7fc1a98a58f8101ee780d4735079ad99ae35 --- src/nvim/regexp_defs.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/nvim/regexp_defs.h') diff --git a/src/nvim/regexp_defs.h b/src/nvim/regexp_defs.h index 3b94723d4f..16bb2db464 100644 --- a/src/nvim/regexp_defs.h +++ b/src/nvim/regexp_defs.h @@ -15,10 +15,22 @@ #include "nvim/pos.h" #include "nvim/types.h" +/// Used for "magic_overruled". typedef enum { - MAGIC_NOT_SET, ///< p_magic not overruled - MAGIC_ON, ///< magic on inside regexp - MAGIC_OFF, ///< magic off inside regexp + OPTION_MAGIC_NOT_SET, ///< p_magic not overruled + OPTION_MAGIC_ON, ///< magic on inside regexp + OPTION_MAGIC_OFF, ///< magic off inside regexp +} optmagic_T; + +/// Magicness of a pattern, used by regexp code. +/// The order and values matter: +/// magic <= MAGIC_OFF includes MAGIC_NONE +/// magic >= MAGIC_ON includes MAGIC_ALL +typedef enum { + MAGIC_NONE = 1, ///< "\V" very unmagic + MAGIC_OFF = 2, ///< "\M" or 'magic' off + MAGIC_ON = 3, ///< "\m" or 'magic' + MAGIC_ALL = 4, ///< "\v" very magic } magic_T; // The number of sub-matches is limited to 10. -- cgit