In normal mode decrement (Ctrl-X) the following number
000000000
it returns
01777777777777777777777
The result should preserve the length of the number and result in
017777777
9.0 1051
Ubuntu 22.04.1 LTS
Gnome Terminal
xterm-256color
ZSH
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I've recompiled Vim and issue still exists on version 9.0 Included patches: 1-1285
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Comment from Marvin Renich on the vim-dev list was not included here:
I'm not sure the current behavior is wrong. Octal numbers are treated
as unsigned, and 64-bit arithmetic is being used.
The help says "Vim preserves the number of characters in the number when
possible." Note that if you use Ctrl-A on 077 you get 0100. The result
of Ctrl-X on 0000 is (2*64)-1, which requires more digits to represent.
Bram should determine what he intended here, and what makes most sense,
but I think the current behavior makes more sense and obeys the docs.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
My comment on the vim-dev list was not included here:
Changing the resulting value is not backwards compatible. It might
cause problems (although I doubt more than a few users actually use
octal numbers these days).
There are a few alternatives to the current behavior, and I can't say
any of them is really better than the current behavior. E.g., going to
minus one or considering the change to be an error (disallow wraparound).
We could perhaps make the help a bit clearer. Any suggestions?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The reason why I discovered this was because Vim parses Docker tags as octal numbers.
I don't really care about octal numbers, just thought that this behavior was weird.
The solution to my problem would be to either explicitly tell vim to do a base10 increment, or disable the "smart" guessing.
I'm not familiar with the code so I don't know where to look.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
so I guess you want: :set nrformat-=octal
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
so I guess you want:
:set nrformat-=octal
Yes! I didn't know that nrformat existed.
Thanks for the help. Sorry to bother you.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #11889 as completed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()