From 3afef2de7e784c5a07f0924a790f0c4e0c55b447 Mon Sep 17 00:00:00 2001
From: Klaus Zerwes <zerwes@users.noreply.github.com>
Date: Wed, 8 Jan 2025 21:16:43 +0100
Subject: [PATCH] taskmatch ends exclude block - fixes issue #31

---
 fqcn-fixer.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fqcn-fixer.py b/fqcn-fixer.py
index f96ff12..f4181be 100755
--- a/fqcn-fixer.py
+++ b/fqcn-fixer.py
@@ -384,6 +384,7 @@ def increase_indent(self, flow=False, *dargs, **dkwargs): # pylint: disable=keyw
             if args.printdiff:
                 originallines.append(line)
             nline = line
+            taskmatch = _taskstartregex.match(line)
             if checkstartexcludeblock(line):
                 in_ignore_block = True
                 startingwhitespaces_ignore_block = re.match(r'\s*-?\s*', line).group()
@@ -398,11 +399,15 @@ def increase_indent(self, flow=False, *dargs, **dkwargs): # pylint: disable=keyw
                     startingwhitespaces_ignore_block = None
                     if args.debug:
                         debugmsg('end exclude block!')
+                elif taskmatch:
+                    in_ignore_block = False
+                    startingwhitespaces_ignore_block = None
+                    if args.debug:
+                        debugmsg('taskmatch in exclude block => end exclude block!')
                 else:
                     if args.debug:
                         debugmsg('... in exclude block ... ignore line')
             if not in_ignore_block:
-                taskmatch = _taskstartregex.match(line)
                 if taskmatch:
                     if args.debug:
                         debugmsg('taskmatch: %s' % taskmatch)