When 'formatexpr' evaluates to non-zero fall back to internal formatting, also
for "gq". (James Vega)
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index ec19680..ca34f7c 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -3126,8 +3126,10 @@
text beyond that limit. This happens under the same conditions as
when internal formatting is used. Make sure the cursor is kept in the
same spot relative to the text then! The |mode()| function will
- return "i" or "R" in this situation. When the function returns
- non-zero Vim will fall back to using the internal format mechanism.
+ return "i" or "R" in this situation.
+
+ When the expression evaluates to non-zero Vim will fall back to using
+ the internal format mechanism.
The expression may be evaluated in the |sandbox|, see
|sandbox-option|.
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 60cc355..367987f 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1093,7 +1093,6 @@
- Conceal feature: no update when moving to another window. (Dominique Pelle,
2010 Jul 5) Vince will look into it.
Patches to possibly include:
-- Patch to improve javascript indenting. (Hari Kumar G, 2010 May 22)
- Patch to use return value of 'formatexpr'. (James Vega, 2010 Jun 16)
- Patch for gtk main_loop() to enable GtkFileChooser. (James Vega, 2010 Jun 28)
Same as this one? GTK: file chooser is disabled. Patch by Tim Starling,
diff --git a/src/ops.c b/src/ops.c
index cf83a88..4eef688 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -4475,7 +4475,10 @@
redraw_curbuf_later(INVERTED);
# endif
- (void)fex_format(oap->start.lnum, oap->line_count, NUL);
+ if (fex_format(oap->start.lnum, oap->line_count, NUL) != 0)
+ /* As documented: when 'formatexpr' returns non-zero fall back to
+ * internal formatting. */
+ op_format(oap, FALSE);
}
int