VimwikiTask: Any header terminates search for viewport

This commit is contained in:
Tomas Babej 2016-12-12 23:39:17 +01:00
parent c474a7c958
commit 0f50979a42
2 changed files with 14 additions and 0 deletions

View file

@ -60,6 +60,14 @@ GENERIC_VIEWPORT = re.compile(
'[=]+' # Header ending
)
GENERIC_HEADER = re.compile(
'^' # Starts at the beginning of the line
'[=]+' # With a positive number of =
'[^=]+' # Character other than =
'[=]+' # Positive number of =, closing the header
'\s*' # Allow trailing whitespace
)
ANSI_ESCAPE_SEQ = re.compile(
'\x1b' # literal ESC
'\[' # literal [

View file

@ -351,3 +351,9 @@ class VimwikiTask(object):
# If port was detected, break the search
break
# If line matches any header that is not a viewport,
# break the search too
line = self.cache.buffer[i]
if re.match(regexp.GENERIC_HEADER, line):
break