Monday, March 30, 2015

Re: Incorrect column positions with vertical splits

Thanks, that explains a lot of things. I just noticed that the status
line I'm using (copied from someone else) uses the "virtual column"
(%v) number instead of the normal column number (%c), which apparently
includes the padding. I've replaced it by "%c%V" now to get both
numbers (the latter only if different from the first).

It's still annoying that the '|'-key uses the "virtual" column number,
too, I didn't expect that. Not sure whether there is a better way,
but instead of '{n}|' I've tried '0{n-1}l', which works well enough
for me.

Best regards,
Markus

On Mon, Mar 30, 2015 at 2:11 PM, Mathias Rav <mathiasrav@gmail.com> wrote:
> This happens when the linebreak setting is set, which causes Vim to
> break the line at whitespace instead of in the middle of any word.
>
> When I resize my terminal to 60 characters, and create the line
> consisting of 40 'x', a space, 40 'x', the ruler displays 1,41 when my
> cursor is on the space and 1,42-61 when my cursor is on the first 'x'
> of the second word. I believe 42 is the byte offset of the character
> under the cursor relative to the beginning of the line, whereas 61 is
> the column of the cursor in the current line. Vim had to add 20 spaces
> to pad the line, which explains why the cursor would be at column 61.
>
> Is that not what you observe?
>
> Best,
> Mathias Rav
>
> On Mon, Mar 30, 2015 at 5:29 PM, Markus Mottl <markus.mottl@gmail.com> wrote:
>> Hi,
>>
>> Vim may report incorrect column positions when vertical splits force a
>> line to wrap.
>>
>> E.g. enter a line consisting of 80 characters of 'x's. Now perform
>> vertical splits until the split windows are too small to display all
>> 80 characters in one line. Right now, Vim will still display correct
>> column positions in the status line, because it cannot break the line
>> at a word boundary and hence needs to wrap it within the word.
>>
>> Now move the cursor to e.g. column 40 and replace the 'x' there with a
>> whitespace. Vim will break the line at the whitespace. If you move
>> the cursor past the break, you will notice that the column count in
>> the status line will suddenly jump, apparently incorrectly counting
>> some whitespace that was used to fill in the break.
>>
>> Note that jumping to column positions in the line using '|' will not
>> work as expected anymore either if the position falls within the "jump
>> range". The cursor will just move to the position of the break
>> instead.
>>
>> This problem was observed using text-mode Vim version 7.4.258 on Mac OS X.
>>
>> Best regards,
>> Markus
>>
>> --
>> Markus Mottl http://www.ocaml.info markus.mottl@gmail.com
>>
>> --
>> --
>> You received this message from the "vim_use" 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_use" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.



--
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: