summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-11 17:35:50 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-11 17:35:50 +0200
commit700303e8f75ff5c67ce1bd45b3cc4de84e06c014 (patch)
tree898c17b5b6d072ef1d38fce830092d18367effb7
parent3acfc30409eb8e3721d888f2e7111111057fe937 (diff)
downloadvim-git-700303e8f75ff5c67ce1bd45b3cc4de84e06c014.tar.gz
When 'formatexpr' evaluates to non-zero fall back to internal formatting, also
for "gq". (James Vega)
-rw-r--r--runtime/doc/options.txt6
-rw-r--r--runtime/doc/todo.txt1
-rw-r--r--src/ops.c5
3 files changed, 8 insertions, 4 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index ec19680d5..ca34f7c4d 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -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|.
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 60cc35555..367987fe9 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -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,
diff --git a/src/ops.c b/src/ops.c
index cf83a884a..4eef68888 100644
--- 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