summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-12-28 22:39:57 +0000
committerBram Moolenaar <Bram@vim.org>2005-12-28 22:39:57 +0000
commitebefac63f30ac038c0c35d7f1b9257483ec41812 (patch)
tree63e6374375ebc6744379fba43c1c557187490143 /src/misc2.c
parentcc984263d755d05a12c8391abff42c087237554e (diff)
downloadvim-git-ebefac63f30ac038c0c35d7f1b9257483ec41812.tar.gz
updated for version 7.0177v7.0177
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c11
1 files changed, 7 insertions, 4 deletions
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