From ebefac63f30ac038c0c35d7f1b9257483ec41812 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Wed, 28 Dec 2005 22:39:57 +0000 Subject: updated for version 7.0177 --- src/misc2.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/misc2.c') diff --git a/src/misc2.c b/src/misc2.c index e8845e25a..c3f2b3798 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -177,7 +177,7 @@ coladvance2(pos, addspaces, finetune, wcol) #ifdef FEAT_VIRTUALEDIT int width = W_WIDTH(curwin) - win_col_off(curwin); - if ((addspaces || finetune) + if (finetune && curwin->w_p_wrap # ifdef FEAT_VERTSPLIT && curwin->w_width != 0 @@ -188,10 +188,13 @@ coladvance2(pos, addspaces, finetune, wcol) if (csize > 0) csize--; - if (wcol / width > (colnr_T)csize / width) + if (wcol / width > (colnr_T)csize / width + && ((State & INSERT) == 0 || (int)wcol > csize + 1)) { /* In case of line wrapping don't move the cursor beyond the - * right screen edge. */ + * right screen edge. In Insert mode allow going just beyond + * the last character (like what happens when typing and + * reaching the right window edge). */ wcol = (csize / width + 1) * width - 1; } } @@ -501,7 +504,7 @@ check_cursor_col() { /* Allow cursor past end-of-line in Insert mode, restarting Insert * mode or when in Visual mode and 'selection' isn't "old" */ - if (State & INSERT || restart_edit + if ((State & INSERT) || restart_edit #ifdef FEAT_VISUAL || (VIsual_active && *p_sel != 'o') #endif -- cgit v1.2.1