]> granicus.if.org Git - vim/commitdiff
When 'formatexpr' evaluates to non-zero fall back to internal formatting, also
authorBram Moolenaar <Bram@vim.org>
Sun, 11 Jul 2010 15:35:50 +0000 (17:35 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 11 Jul 2010 15:35:50 +0000 (17:35 +0200)
for "gq". (James Vega)

runtime/doc/options.txt
runtime/doc/todo.txt
src/ops.c

index ec19680d553b1751ff30dba362c5b633a9e3f0d7..ca34f7c4def81e48dd3c9d4281d6c32ae18cb95e 100644 (file)
@@ -3126,8 +3126,10 @@ A jump table for the options with a short description can be found at |Q_op|.
        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|.
index 60cc3555558fefb4d1c6d9485db94a799254b2de..367987fe9c3c60438e4e1a64a2ff89eb0b077e3e 100644 (file)
@@ -1093,7 +1093,6 @@ Vim 7.3:
 - 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,
index cf83a884a7775ff408b8080ee871a96be7a60b00..4eef6888817fc281a1e2b7e6bd25dedbd48d077f 100644 (file)
--- a/src/ops.c
+++ b/src/ops.c
@@ -4475,7 +4475,10 @@ op_formatexpr(oap)
        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