Bram,
since 7.4.530 the address has a different meaning for certain commands.
I am not sure, if it makes sense, to adjust the address for folded
lines, if the address type is not of type ADDR_LINES. This might be
unexpected, see e.g. here https://vi.stackexchange.com/questions/5810
So here is a patch, that only adjusts the address for ex commands, that
work on lines.
Best,
Christian
--
Was, herzkrank sind sie? Ich möchte wissen wo!
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt
--- a/runtime/doc/fold.txt
+++ b/runtime/doc/fold.txt
@@ -585,12 +585,13 @@ what you type!
When using an operator, a closed fold is included as a whole. Thus "dl"
deletes the whole closed fold under the cursor.
-For Ex commands the range is adjusted to always start at the first line of a
-closed fold and end at the last line of a closed fold. Thus this command: >
- :s/foo/bar/g
-when used with the cursor on a closed fold, will replace "foo" with "bar" in
-all lines of the fold.
-This does not happen for |:folddoopen| and |:folddoclosed|.
+For Ex commands, that work on lines, the range is adjusted to always start at
+the first line of a closed fold and end at the last line of a closed fold.
+Thus this command: >
+ :s/foo/bar/g
+when used with the cursor on a closed fold,
+will replace "foo" with "bar" in all lines of the fold. This does not happen
+for |:folddoopen| and |:folddoclosed|.
When editing a buffer that has been edited before, the last used folding
settings are used again. For manual folding the defined folds are restored.
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -2543,7 +2543,8 @@ do_one_cmd(cmdlinep, sourcing,
correct_range(&ea);
#ifdef FEAT_FOLDING
- if (((ea.argt & WHOLEFOLD) || ea.addr_count >= 2) && !global_busy)
+ if (((ea.argt & WHOLEFOLD) || ea.addr_count >= 2) && !global_busy
+ && ea.addr_type == ADDR_LINES)
{
/* Put the first line at the start of a closed fold, put the last line
* at the end of a closed fold. */