summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-04-29 12:15:40 +0200
committerBram Moolenaar <Bram@vim.org>2014-04-29 12:15:40 +0200
commitd69bd9af3ccf5edd2138fb7abd68d35f7b84ef7e (patch)
tree722c4dd7ab344ec2ffc904b229de7aa2dd8c63d8 /src
parent33e87789a740fadcae473c60a00de2a13c55a7d0 (diff)
downloadvim-git-d69bd9af3ccf5edd2138fb7abd68d35f7b84ef7e.tar.gz
updated for version 7.4.267v7.4.267
Problem: The '[ mark is in the wrong position after "gq". (Ingo Karkat) Solution: Add the setmark argument to do_join(). (Christian Brabandt)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile1
-rw-r--r--src/edit.c4
-rw-r--r--src/ex_cmds.c2
-rw-r--r--src/ex_docmd.c2
-rw-r--r--src/normal.c6
-rw-r--r--src/ops.c24
-rw-r--r--src/proto/ops.pro2
-rw-r--r--src/testdir/Make_amiga.mak2
-rw-r--r--src/testdir/Make_dos.mak1
-rw-r--r--src/testdir/Make_ming.mak1
-rw-r--r--src/testdir/Make_os2.mak1
-rw-r--r--src/testdir/Make_vms.mms1
-rw-r--r--src/testdir/Makefile2
-rw-r--r--src/testdir/test_autoformat_join.in23
-rw-r--r--src/testdir/test_autoformat_join.ok8
-rw-r--r--src/version.c2
16 files changed, 65 insertions, 17 deletions
diff --git a/src/Makefile b/src/Makefile
index 30545aac6..223fdc0dc 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1880,6 +1880,7 @@ unittest unittests: $(UNITTEST_TARGETS)
# Run individual test, assuming that Vim was already compiled.
test1 test2 test3 test4 test5 test6 test7 test8 test9 \
+ test_autoformat_join \
test_eval \
test_options \
test10 test11 test12 test13 test14 test15 test16 test17 test18 test19 \
diff --git a/src/edit.c b/src/edit.c
index 1c6f2f899..24010c8d9 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -8685,7 +8685,7 @@ ins_del()
{
temp = curwin->w_cursor.col;
if (!can_bs(BS_EOL) /* only if "eol" included */
- || do_join(2, FALSE, TRUE, FALSE) == FAIL)
+ || do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL)
vim_beep();
else
curwin->w_cursor.col = temp;
@@ -8866,7 +8866,7 @@ ins_bs(c, mode, inserted_space_p)
ptr[len - 1] = NUL;
}
- (void)do_join(2, FALSE, FALSE, FALSE);
+ (void)do_join(2, FALSE, FALSE, FALSE, FALSE);
if (temp == NUL && gchar_cursor() != NUL)
inc_cursor();
}
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index ac30f2c01..f6643aed6 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4444,7 +4444,7 @@ do_sub(eap)
else if (*cmd == 'p')
eap->flags = EXFLAG_PRINT;
- (void)do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE);
+ (void)do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE, TRUE);
sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1;
(void)do_sub_msg(FALSE);
ex_may_print(eap);
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 001ccd7ea..a88cdd564 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -8717,7 +8717,7 @@ ex_join(eap)
}
++eap->line2;
}
- (void)do_join(eap->line2 - eap->line1 + 1, !eap->forceit, TRUE, TRUE);
+ (void)do_join(eap->line2 - eap->line1 + 1, !eap->forceit, TRUE, TRUE, TRUE);
beginline(BL_WHITE | BL_FIX);
ex_may_print(eap);
}
diff --git a/src/normal.c b/src/normal.c
index 15abab290..e5fa1401c 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -812,7 +812,7 @@ getcount:
if (text_locked() && (nv_cmds[idx].cmd_flags & NV_NCW))
{
- /* This command is not allowed while editing a ccmdline: beep. */
+ /* This command is not allowed while editing a cmdline: beep. */
clearopbeep(oap);
text_locked_msg();
goto normal_end;
@@ -1905,7 +1905,7 @@ do_pending_operator(cap, old_col, gui_yank)
else
{
(void)do_join(oap->line_count, oap->op_type == OP_JOIN,
- TRUE, TRUE);
+ TRUE, TRUE, TRUE);
auto_format(FALSE, TRUE);
}
break;
@@ -9236,7 +9236,7 @@ nv_join(cap)
{
prep_redo(cap->oap->regname, cap->count0,
NUL, cap->cmdchar, NUL, NUL, cap->nchar);
- (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE);
+ (void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);
}
}
}
diff --git a/src/ops.c b/src/ops.c
index fee7a0cfc..c0337352e 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -1979,7 +1979,7 @@ op_delete(oap)
curwin->w_cursor = curpos; /* restore curwin->w_cursor */
}
if (curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count)
- (void)do_join(2, FALSE, FALSE, FALSE);
+ (void)do_join(2, FALSE, FALSE, FALSE, FALSE);
}
}
@@ -4323,17 +4323,20 @@ skip_comment(line, process, include_space, is_comment)
/*
* Join 'count' lines (minimal 2) at cursor position.
* When "save_undo" is TRUE save lines for undo first.
- * Set "use_formatoptions" to FALSE when e.g. processing
- * backspace and comment leaders should not be removed.
+ * Set "use_formatoptions" to FALSE when e.g. processing backspace and comment
+ * leaders should not be removed.
+ * When setmark is TRUE, sets the '[ and '] mark, else, the caller is expected
+ * to set those marks.
*
* return FAIL for failure, OK otherwise
*/
int
-do_join(count, insert_space, save_undo, use_formatoptions)
+do_join(count, insert_space, save_undo, use_formatoptions, setmark)
long count;
int insert_space;
int save_undo;
int use_formatoptions UNUSED;
+ int setmark;
{
char_u *curr = NULL;
char_u *curr_start = NULL;
@@ -4384,7 +4387,7 @@ do_join(count, insert_space, save_undo, use_formatoptions)
for (t = 0; t < count; ++t)
{
curr = curr_start = ml_get((linenr_T)(curwin->w_cursor.lnum + t));
- if (t == 0)
+ if (t == 0 && setmark)
{
/* Set the '[ mark. */
curwin->w_buffer->b_op_start.lnum = curwin->w_cursor.lnum;
@@ -4506,9 +4509,12 @@ do_join(count, insert_space, save_undo, use_formatoptions)
}
ml_replace(curwin->w_cursor.lnum, newp, FALSE);
- /* Set the '] mark. */
- curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
- curwin->w_buffer->b_op_end.col = (colnr_T)STRLEN(newp);
+ if (setmark)
+ {
+ /* Set the '] mark. */
+ curwin->w_buffer->b_op_end.lnum = curwin->w_cursor.lnum;
+ curwin->w_buffer->b_op_end.col = (colnr_T)STRLEN(newp);
+ }
/* Only report the change in the first line here, del_lines() will report
* the deleted line. */
@@ -5009,7 +5015,7 @@ format_lines(line_count, avoid_fex)
}
}
curwin->w_cursor.lnum--;
- if (do_join(2, TRUE, FALSE, FALSE) == FAIL)
+ if (do_join(2, TRUE, FALSE, FALSE, FALSE) == FAIL)
{
beep_flush();
break;
diff --git a/src/proto/ops.pro b/src/proto/ops.pro
index 0710ec611..fe40151cd 100644
--- a/src/proto/ops.pro
+++ b/src/proto/ops.pro
@@ -37,7 +37,7 @@ void adjust_cursor_eol __ARGS((void));
int preprocs_left __ARGS((void));
int get_register_name __ARGS((int num));
void ex_display __ARGS((exarg_T *eap));
-int do_join __ARGS((long count, int insert_space, int save_undo, int use_formatoptions));
+int do_join __ARGS((long count, int insert_space, int save_undo, int use_formatoptions, int setmark));
void op_format __ARGS((oparg_T *oap, int keep_cursor));
void op_formatexpr __ARGS((oparg_T *oap));
int fex_format __ARGS((linenr_T lnum, long count, int c));
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index 3492945eb..c8a529e6c 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -36,6 +36,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test94.out test95.out test96.out test97.out test98.out \
test99.out test100.out test101.out test102.out test103.out \
test104.out test105.out test106.out \
+ test_autoformat_join.out \
test_eval.out \
test_options.out
@@ -160,5 +161,6 @@ test103.out: test103.in
test104.out: test104.in
test105.out: test105.in
test106.out: test106.in
+test_autoformat_join.out: test_autoformat_join.in
test_eval.out: test_eval.in
test_options.out: test_options.in
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index a85980ea0..4efaeb45d 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -35,6 +35,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out \
+ test_autoformat_join.out \
test_eval.out \
test_options.out
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index 0bb22cb7b..f589f2084 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -55,6 +55,7 @@ SCRIPTS = test3.out test4.out test5.out test6.out test7.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out \
+ test_autoformat_join.out \
test_eval.out \
test_options.out
diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak
index a84ade6ff..4406f7d93 100644
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -37,6 +37,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
test94.out test95.out test96.out test98.out test99.out \
test100.out test101.out test102.out test103.out test104.out \
test105.out test106.out \
+ test_autoformat_join.out \
test_eval.out \
test_options.out
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 89c4a84cc..af839e862 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -96,6 +96,7 @@ SCRIPT = test1.out test2.out test3.out test4.out test5.out \
test95.out test96.out test98.out test99.out \
test100.out test101.out test103.out test104.out \
test105.out test106.out \
+ test_autoformat_join.out \
test_eval.out \
test_options.out
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index 66536ae44..65c82e089 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -33,6 +33,8 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
test94.out test95.out test96.out test97.out test98.out \
test99.out test100.out test101.out test102.out test103.out \
test104.out test105.out test106.out \
+ test_autoformat_join.out \
+ test_eval.out \
test_options.out
SCRIPTS_GUI = test16.out
diff --git a/src/testdir/test_autoformat_join.in b/src/testdir/test_autoformat_join.in
new file mode 100644
index 000000000..f1e1c868d
--- /dev/null
+++ b/src/testdir/test_autoformat_join.in
@@ -0,0 +1,23 @@
+Tests for setting the '[,'] marks when joining lines.
+
+STARTTEST
+:so small.vim
+:/^\t\t/
+0gqj
+:let a=string(getpos("'[")).'/'.string(getpos("']"))
+:/^This line/;'}-join
+:let b=string(getpos("'[")).'/'.string(getpos("']"))
+:$put ='First test: Start/End '.string(a)
+:$put ='Second test: Start/End '.string(b)
+:/^\t\t/,$wq! test.out
+ENDTEST
+
+
+ O sodales, ludite, vos qui
+attamen consulite per voster honur. Tua pulchra facies me fay planszer milies
+
+This line.
+Should be joined with the next line
+and with this line
+
+Results:
diff --git a/src/testdir/test_autoformat_join.ok b/src/testdir/test_autoformat_join.ok
new file mode 100644
index 000000000..3b1df7951
--- /dev/null
+++ b/src/testdir/test_autoformat_join.ok
@@ -0,0 +1,8 @@
+ O sodales, ludite, vos qui attamen consulite per voster honur.
+Tua pulchra facies me fay planszer milies
+
+This line. Should be joined with the next line and with this line
+
+Results:
+First test: Start/End '[0, 16, 1, 0]/[0, 17, 1, 0]'
+Second test: Start/End '[0, 19, 11, 0]/[0, 19, 67, 0]'
diff --git a/src/version.c b/src/version.c
index 900051917..5aae1d2a7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -735,6 +735,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 267,
+/**/
266,
/**/
265,