aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2015-12-13 01:47:34 -0500
committerJustin M. Keyes <justinkz@gmail.com>2015-12-13 01:47:34 -0500
commitf406ae412e1fa37bec3d1ff89ebc0d9cab445a3b (patch)
treee374d4831228cd75a22e0117b53cc978d3026333 /src/nvim/edit.c
parentc3e4e0e383401bdd0ac9cac4b81e1c4e160be166 (diff)
parent815fe2460431bffae089c67939ce423d008b6648 (diff)
downloadrneovim-f406ae412e1fa37bec3d1ff89ebc0d9cab445a3b.tar.gz
rneovim-f406ae412e1fa37bec3d1ff89ebc0d9cab445a3b.tar.bz2
rneovim-f406ae412e1fa37bec3d1ff89ebc0d9cab445a3b.zip
Merge pull request #3838 from Shougo/vim-7.4.658
vim-patch:7.4.658
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index e820ea3d2b..9ba5d96e16 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -5017,8 +5017,9 @@ insertchar (
int textwidth;
char_u *p;
int fo_ins_blank;
+ int force_format = flags & INSCHAR_FORMAT;
- textwidth = comp_textwidth(flags & INSCHAR_FORMAT);
+ textwidth = comp_textwidth(force_format);
fo_ins_blank = has_format_option(FO_INS_BLANK);
/*
@@ -5037,7 +5038,7 @@ insertchar (
* before 'textwidth'
*/
if (textwidth > 0
- && ((flags & INSCHAR_FORMAT)
+ && (force_format
|| (!ascii_iswhite(c)
&& !((State & REPLACE_FLAG)
&& !(State & VREPLACE_FLAG)
@@ -5051,8 +5052,11 @@ insertchar (
/* Format with 'formatexpr' when it's set. Use internal formatting
* when 'formatexpr' isn't set or it returns non-zero. */
int do_internal = TRUE;
+ colnr_T virtcol = get_nolist_virtcol()
+ + char2cells(c != NUL ? c : gchar_cursor());
- if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0) {
+ if (*curbuf->b_p_fex != NUL && (flags & INSCHAR_NO_FEX) == 0
+ && (force_format || virtcol > (colnr_T)textwidth)) {
do_internal = (fex_format(curwin->w_cursor.lnum, 1L, c) != 0);
/* It may be required to save for undo again, e.g. when setline()
* was called. */