To: vim-dev@vim.org Subject: Patch 6.0.193 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.193 Problem: When 'virtualedit' is set, col(".") after the end of the line should return one extra. Solution: Add one to the column. Files: src/eval.c *** ../vim60.192/src/eval.c Wed Feb 6 11:45:41 2002 --- src/eval.c Wed Feb 6 20:16:23 2002 *************** *** 3057,3063 **** --- 3057,3087 ---- fp = var2fpos(&argvars[0], FALSE); if (fp != NULL) + { col = fp->col + 1; + #ifdef FEAT_VIRTUALEDIT + /* col(".") when the cursor is on the NUL at the end of the line + * because of "coladd" can be seen as an extra column. */ + if (virtual_active() && fp == &curwin->w_cursor) + { + char_u *p = ml_get_cursor(); + + if (curwin->w_cursor.coladd >= chartabsize(p, + curwin->w_virtcol - curwin->w_cursor.coladd)) + { + # ifdef FEAT_MBYTE + int l; + + if (*p != NUL && p[(l = (*mb_ptr2len_check)(p))] == NUL) + col += l; + # else + if (*p != NUL && p[1] == NUL) + ++col; + # endif + } + } + #endif + } retvar->var_val.var_number = col; } *** ../vim60.192/src/version.c Wed Feb 6 17:47:31 2002 --- src/version.c Wed Feb 6 20:29:50 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 193, /**/ -- Vi is clearly superior to emacs, since "vi" has only two characters (and two keystrokes), while "emacs" has five. (Randy C. Ford) /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///