aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds.c
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-12-14 13:10:14 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-12-15 01:38:56 +0100
commitb8123cb4af70b9f241364e717e4d3063e6cda37d (patch)
tree6de193245f5c4a60d273fabc007caaef97069634 /src/nvim/ex_cmds.c
parenta5edc5f2572d6d63f7f7a32ae6ec7bcabe1472b6 (diff)
downloadrneovim-b8123cb4af70b9f241364e717e4d3063e6cda37d.tar.gz
rneovim-b8123cb4af70b9f241364e717e4d3063e6cda37d.tar.bz2
rneovim-b8123cb4af70b9f241364e717e4d3063e6cda37d.zip
vim-patch:7.4.543.
Adapt #1533 and #1596 to conform to upstream patch (https://groups.google.com/forum/#!topic/vim_dev/vp0Lwo9f56s). Problem: Since patch 7.4.232 "1,3s/\n//" joins two lines instead of three. (Eliseo Martínez) Issue 287 Solution: Correct the line count. (Christian Brabandt) Also set the last used search pattern.
Diffstat (limited to 'src/nvim/ex_cmds.c')
-rw-r--r--src/nvim/ex_cmds.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 1c6aa536b3..049934d680 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3604,9 +3604,10 @@ void do_sub(exarg_T *eap)
eap->flags = EXFLAG_PRINT;
}
- linenr_T joined_lines_count = eap->line2 < curbuf->b_ml.ml_line_count
- ? eap->line2 - eap->line1 + 2
- : eap->line2 - eap->line1 + 1;
+ // The number of lines joined is the number of lines in the range
+ linenr_T joined_lines_count = eap->line2 - eap->line1 + 1
+ // plus one extra line if not at the end of file.
+ + eap->line2 < curbuf->b_ml.ml_line_count ? 1 : 0;
if (joined_lines_count > 1) {
do_join(joined_lines_count, FALSE, TRUE, FALSE, true);
sub_nsubs = joined_lines_count - 1;
@@ -3615,6 +3616,11 @@ void do_sub(exarg_T *eap)
ex_may_print(eap);
}
+ if (!cmdmod.keeppatterns) {
+ save_re_pat(RE_SUBST, pat, p_magic);
+ }
+ add_to_history(HIST_SEARCH, pat, TRUE, NUL);
+
return;
}