From 4accbf5f906f4edcf7f973ab13212b6eee863522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sen=C3=ADn?= Date: Sun, 6 Feb 2022 02:06:08 +0100 Subject: [PATCH] Avoid repeated matches due blank spaces or tabs There are match loops using index + len(match) due spaces and tabs are not being calculated, so a regex could match many times when the line has spaces or tabs --- plugin/semhl.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/semhl.vim b/plugin/semhl.vim index 9968132..d80f97d 100644 --- a/plugin/semhl.vim +++ b/plugin/semhl.vim @@ -111,7 +111,7 @@ function! s:semHighlight() let curline = getline(buflen) let index = 0 while 1 - let match = matchstr(curline, pattern, index) + let [match, start_at, stop_at] = matchstrpos(curline, pattern, index) if (empty(match)) break @@ -129,7 +129,7 @@ function! s:semHighlight() let cur_color = (cur_color + 1) % colorLen endif - let index += len(match) + 1 + let index = stop_at endwhile let buflen -= 1 endwhile