On 2015-02-10, Christian Brabandt wrote:
> Am 2015-02-10 04:15, schrieb Gary Johnson:
> >Given a file with the following contents,
> >
> >ape(x
> >boy(y
> >cat(
> >dog(z
> >emu(
> >
> >and opened with
> >
> > vim -N -u NONE file
> >
> >this search command,
> >
> > /(/e+1
> >
> >will first move the cursor to the 'x' at the end of the first line,
> >as expected. Typing 'n' will then move the cursor to
> >
> > - the 'y' at the end of the second line (OK)
> > - the 'd' at the start of the fourth line (odd)
> > - the 'z' at the end of the fourth line (OK)
> > - the '(' at the end of the last line (odd)
> >
> >Typing 'n' again will not move the cursor (bad).
> >
> >It seems odd that the match wraps to the start of line 4, but I can
> >accept that. That typing 'n' does not continue the search from the
> >start of the file is really annoying.
>
> Where should the cursor move for the last line? To line 1 if wrapscan
> is set?
I don't know. Since Vim patterns don't span lines unless the
newline is accounted for specially, it seems odd to me that the e
offset spans lines. I'm not saying it's wrong, it just feels odd to
me. That could be because I used vi for so long before using Vim.
Regardless of where the cursor should be for the last line, it seems
wrong that the cursor gets stuck there. It gets stuck at the end of
the file for any pattern and offset that would place the cursor
beyond the last character in the buffer.
Vim can't place the cursor beyond the last character in the buffer,
though, so it actually puts the cursor on the last character in the
buffer. Typing 'n' at that point should move the cursor to the next
match, even if that would be some virtual character to the right of
the cursor location.
I thought there was a precedent for advancing the cursor to the next
match if it would otherwise get stuck in some pattern loop, but I
can't think of exactly what it was. There is a precedent for
remembering where the cursor _would_ be if a character was there:
the movement of j and k over lines shorter than the cursor column.
As long as you only use j and k, the cursor column is remembered.
There could be something similar for this case: a cursor character
location where the cursor would be if a character was there. As
long as the only commands typed are n or N, the next search would
begin from where the cursor would be, not where it actually is.
Regards,
Gary
--
--
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].
For more options, visit https://groups.google.com/d/optout.