if (curline)
break; /* only check cursor line */
+ /* If we are back at the starting line and searched it again there
+ * is no match, give up. */
+ if (lnum == wp->w_cursor.lnum && wrapped)
+ break;
+
/* Advance to next line. */
if (dir == BACKWARD)
{
- /* If we are back at the starting line and searched it again there
- * is no match, give up. */
- if (lnum == wp->w_cursor.lnum && wrapped)
- break;
-
if (lnum > 1)
--lnum;
else if (!p_ws)
/* If we are back at the starting line and there is no match then
* give up. */
- if (lnum == wp->w_cursor.lnum && (!found_one || wrapped))
+ if (lnum == wp->w_cursor.lnum && !found_one)
break;
/* Skip the characters at the start of the next line that were
--- /dev/null
+" Test spell checking
+" TODO: move test58 tests here
+
+if !has('spell')
+ finish
+endif
+
+func Test_wrap_search()
+ new
+ call setline(1, ['The', '', 'A plong line with two zpelling mistakes', '', 'End'])
+ set spell wrapscan
+ normal ]s
+ call assert_equal('plong', expand('<cword>'))
+ normal ]s
+ call assert_equal('zpelling', expand('<cword>'))
+ normal ]s
+ call assert_equal('plong', expand('<cword>'))
+ bwipe!
+ set nospell
+endfunc