patch 9.1.1754: :helptags doesn't skip examples with syntax
Commit:
https://github.com/vim/vim/commit/6f020cde569073622cc085251e47d82323d5c4bd
Author: zeertzjq <[email protected]>
Date: Thu Sep 11 15:21:52 2025 -0400
patch 9.1.1754: :helptags doesn't skip examples with syntax
Problem: :helptags doesn't skip examples with syntax
(Evgeni Chasnovski)
Solution: Check for examples with syntax (zeertzjq).
fixes: #18273
closes: #18277
Signed-off-by: zeertzjq <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/help.c b/src/help.c
index 106236201..b4df3809b 100644
--- a/src/help.c
+++ b/src/help.c
@@ -965,7 +965,6 @@ helptags_one(
int this_utf8;
int firstline;
int in_example;
- int len;
int mix = FALSE; // detected mixed encodings
// Find all *.txt files.
@@ -1117,10 +1116,16 @@ helptags_one(
}
p1 = p2;
}
- len = (int)STRLEN(IObuff);
- if ((len == 2 && STRCMP(&IObuff[len - 2], ">
") == 0)
- || (len >= 3 && STRCMP(&IObuff[len - 3], " >
") == 0))
- in_example = TRUE;
+ size_t off = STRLEN(IObuff);
+ if (off >= 2 && IObuff[off - 1] == '
')
+ {
+ off -= 2;
+ while (off > 0 && (ASCII_ISLOWER(IObuff[off])
+ || VIM_ISDIGIT(IObuff[off])))
+ off--;
+ if (IObuff[off] == '>' && (off == 0 || IObuff[off - 1] == ' '))
+ in_example = TRUE;
+ }
line_breakcheck();
}
diff --git a/src/testdir/test_help.vim b/src/testdir/test_help.vim
index dac153d86..820338abd 100644
--- a/src/testdir/test_help.vim
+++ b/src/testdir/test_help.vim
@@ -139,11 +139,17 @@ func Test_helptag_cmd()
call delete('Xtagdir/tags')
" Test parsing tags
- call writefile(['*tag1*', 'Example: >', ' *notag*', 'Example end: *tag2*'],
+ call writefile(['*tag1*', 'Example: >', ' *notag1*', 'Example end: *tag2*',
+ \ '>', ' *notag2*', '<',
+ \ '*tag3*', 'Code: >vim', ' *notag3*', 'Code end: *tag4*',
+ \ '>i3config', ' *notag4*', '<'],
\ 'Xtagdir/a/doc/sample.txt')
helptags Xtagdir
call assert_equal(["tag1 a/doc/sample.txt /*tag1*",
- \ "tag2 a/doc/sample.txt /*tag2*"],
readfile('Xtagdir/tags'))
+ \ "tag2 a/doc/sample.txt /*tag2*",
+ \ "tag3 a/doc/sample.txt /*tag3*",
+ \ "tag4 a/doc/sample.txt /*tag4*"],
+ \ readfile('Xtagdir/tags'))
" Duplicate tags in the help file
call writefile(['*tag1*', '*tag1*', '*tag2*'], 'Xtagdir/a/doc/sample.txt')
diff --git a/src/version.c b/src/version.c
index 3dbb664c3..89787c4d6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1754,
/**/
1753,
/**/
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/vim_dev/E1uwmzd-000Z3h-JL%40256bit.org.