Mercurial > vim
comparison src/charset.c @ 3292:c7861dd3b593 v7.3.414
updated for version 7.3.414
Problem: Using CTRL-A on "000" drops the leading zero, while on "001" it
doesn't.
Solution: Detect "000" as an octal number. (James McCoy)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Thu, 26 Jan 2012 13:40:08 +0100 |
parents | 320cc46d0eb0 |
children | a17918b76ca1 |
comparison
equal
deleted
inserted
replaced
3291:9dbecccbf14e | 3292:c7861dd3b593 |
---|---|
762 #endif | 762 #endif |
763 return (chartab[*p] & CT_CELL_MASK); | 763 return (chartab[*p] & CT_CELL_MASK); |
764 } | 764 } |
765 | 765 |
766 /* | 766 /* |
767 * Return the number of characters string "s" will take on the screen, | 767 * Return the number of character cells string "s" will take on the screen, |
768 * counting TABs as two characters: "^I". | 768 * counting TABs as two characters: "^I". |
769 */ | 769 */ |
770 int | 770 int |
771 vim_strsize(s) | 771 vim_strsize(s) |
772 char_u *s; | 772 char_u *s; |
773 { | 773 { |
774 return vim_strnsize(s, (int)MAXCOL); | 774 return vim_strnsize(s, (int)MAXCOL); |
775 } | 775 } |
776 | 776 |
777 /* | 777 /* |
778 * Return the number of characters string "s[len]" will take on the screen, | 778 * Return the number of character cells string "s[len]" will take on the |
779 * counting TABs as two characters: "^I". | 779 * screen, counting TABs as two characters: "^I". |
780 */ | 780 */ |
781 int | 781 int |
782 vim_strnsize(s, len) | 782 vim_strnsize(s, len) |
783 char_u *s; | 783 char_u *s; |
784 int len; | 784 int len; |
1828 if (ptr[n] > '7') | 1828 if (ptr[n] > '7') |
1829 { | 1829 { |
1830 hex = 0; /* can't be octal */ | 1830 hex = 0; /* can't be octal */ |
1831 break; | 1831 break; |
1832 } | 1832 } |
1833 if (ptr[n] > '0') | 1833 if (ptr[n] >= '0') |
1834 hex = '0'; /* assume octal */ | 1834 hex = '0'; /* assume octal */ |
1835 } | 1835 } |
1836 } | 1836 } |
1837 } | 1837 } |
1838 } | 1838 } |