comparison src/charset.c @ 2339:01e4b4d37842 vim73

Added strdisplaywidth() function.
author Bram Moolenaar <bram@vim.org>
date Sun, 18 Jul 2010 15:45:49 +0200
parents 3cdf2a653e00
children 8a156630208b
comparison
equal deleted inserted replaced
2338:da6ec32d8d8f 2339:01e4b4d37842
837 RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, p, col) 837 RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, p, col)
838 } 838 }
839 #endif 839 #endif
840 840
841 /* 841 /*
842 * return the number of characters the string 's' will take on the screen, 842 * Return the number of characters the string 's' will take on the screen,
843 * taking into account the size of a tab 843 * taking into account the size of a tab.
844 */ 844 */
845 int 845 int
846 linetabsize(s) 846 linetabsize(s)
847 char_u *s; 847 char_u *s;
848 { 848 {
849 colnr_T col = 0; 849 return linetabsize_col(0, s);
850 }
851
852 /*
853 * Like linetabsize(), but starting at column "startcol".
854 */
855 int
856 linetabsize_col(startcol, s)
857 int startcol;
858 char_u *s;
859 {
860 colnr_T col = startcol;
850 861
851 while (*s != NUL) 862 while (*s != NUL)
852 col += lbr_chartabsize_adv(&s, col); 863 col += lbr_chartabsize_adv(&s, col);
853 return (int)col; 864 return (int)col;
854 } 865 }