On Wed, 26 Apr 2006, Hari Krishna Dara wrote:


In Vim 6.3, hitting ^X in insert mode when the cursor is on the number:

08)

produced:

0377777777778)

This is a bug which seems to be fixed in Vim 7.0f, but it doesn't work
right, as it now produces:

7)

instead of:

07)

If the string is say,

07)

both versions correctly produce,

06)

Confirmed for Vim 6.3. Seems like some kind of octal increment/decrement
confusion.

However, I think Hari meant to say Normal mode instead of Insert mode.

Vim thinks that it's an octal number because of 0 followed by [0-9]\+
(yes, it should be [0-7]\+). But when it encounters [8-9]\+\d*$, it
takes 0 as the octal number itself, and not as the octal indicator (as
"0x" is the hex indicator).

This is evident with:

  08123

Placing the cursor on any of the 5 digits and hitting Ctrl-x produces:

  0377777777778123

Some may say it is correct operation ;) except for the fact that Vim
confuses the indicator for the number itself. Hence, performing the same
on:

  008123

also produces:

  0377777777778123

In this case, the good 0 is decremented to -1 in octal.

Of course, the fix for this behavior on any Vim is

  :set nrformats-=octal

See ":help 'nrformats'".

HTH :)
--
Gerald

Reply via email to