Hi Ben!
On Mi, 09 Jan 2013, Ben Fritz wrote:
> This seems to be related to the cursor being within the fold.
Yes, the source code says this:
/* If the cursor is in a closed fold, don't find another match in the same
* fold. */
if (dirc == '/')
{
if (hasFolding(pos.lnum, NULL, &pos.lnum))
pos.col = MAXCOL - 2; /* avoid overflow when adding 1 */
}
This means, the search starts actually after the fold. Because wrapscan
applies, Vim will start searching from the beginning of the file again
and find the match and open the fold. If wrapscan is not set, this will
abort since the pattern is not found.
I am thinking, there should at least be an check for 'foldopen', e.g.
something like this:
diff --git a/src/search.c b/src/search.c
--- a/src/search.c
+++ b/src/search.c
@@ -1126,15 +1126,18 @@
#ifdef FEAT_FOLDING
/* If the cursor is in a closed fold, don't find another match in the same
* fold. */
- if (dirc == '/')
+ if ((fdo_flags & FDO_SEARCH) == 0)
{
- if (hasFolding(pos.lnum, NULL, &pos.lnum))
- pos.col = MAXCOL - 2; /* avoid overflow when adding 1 */
- }
- else
- {
- if (hasFolding(pos.lnum, &pos.lnum, NULL))
- pos.col = 0;
+ if (dirc == '/')
+ {
+ if (hasFolding(pos.lnum, NULL, &pos.lnum))
+ pos.col = MAXCOL - 2; /* avoid overflow when adding 1 */
+ }
+ else
+ {
+ if (hasFolding(pos.lnum, &pos.lnum, NULL))
+ pos.col = 0;
+ }
}
#endif
regards,
Christian
--
Man kann einem Mann nichts abgewöhnen, aber man kann ihm angewöhnen,
daß er sich etwas abgewöhnt.
-- Cathérine Deneuve
--
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