]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.267 v7.4.267
authorBram Moolenaar <Bram@vim.org>
Tue, 29 Apr 2014 10:15:40 +0000 (12:15 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 29 Apr 2014 10:15:40 +0000 (12:15 +0200)
Problem:    The '[ mark is in the wrong position after "gq". (Ingo Karkat)
Solution:   Add the setmark argument to do_join(). (Christian Brabandt)

16 files changed:
src/Makefile
src/edit.c
src/ex_cmds.c
src/ex_docmd.c
src/normal.c
src/ops.c
src/proto/ops.pro
src/testdir/Make_amiga.mak
src/testdir/Make_dos.mak
src/testdir/Make_ming.mak
src/testdir/Make_os2.mak
src/testdir/Make_vms.mms
src/testdir/Makefile
src/testdir/test_autoformat_join.in [new file with mode: 0644]
src/testdir/test_autoformat_join.ok [new file with mode: 0644]
src/version.c

index 30545aac67b471f85cdf7fc7fd616fc8e027b413..223fdc0dc4f94277620fdf471819f533268fe8fb 100644 (file)
@@ -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 \
index 1c6f2f899af6f14e42fc0e79a46fd3e39bceeaf6..24010c8d9cf5320e96f470f26afe5fba099aaf95 100644 (file)
@@ -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();
            }
index ac30f2c01774057a2fcd05a0093fa5e9aa5f939b..f6643aed69fbc8f6bb5dd7c8bf18bf74135ffd68 100644 (file)
@@ -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);
index 001ccd7eab9bf4fe728e8011939e78ff5edaf79e..a88cdd56413010c364ddc07f071e18fb72b7b4fe 100644 (file)
@@ -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);
 }
index 15abab290f71dd51c6fe11ed0886549daf373349..e5fa1401c0785ea891608d60ceedd2845cc3d183 100644 (file)
@@ -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);
        }
     }
 }
index fee7a0cfc091780d4e2bcea2db7bff61691d626e..c0337352e81f69f20acb7b69d19aa4fc1da613a3 100644 (file)
--- 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;
index 0710ec6118ad60b2643219b7d17e1aee6cee89af..fe40151cd4eb2b9ffbdc3cfb6f970f6ce619cc91 100644 (file)
@@ -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));
index 3492945eb75ab76f79af3f587756166e0a81f0f6..c8a529e6cbcf9b239aa0eb3cb4e257eeed434ed8 100644 (file)
@@ -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
index a85980ea0a497b714a103da4fe2e9896848a4c7c..4efaeb45d6c1dbb2037a093deb59433f0ca185b5 100644 (file)
@@ -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
 
index 0bb22cb7b967f06315b83aaa3f24d026c853aba7..f589f208464b2709db0f7d992c49ed70f44c1dc6 100644 (file)
@@ -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
 
index a84ade6ffea53243be65797ab213f8a90fc40e56..4406f7d93111fb0e85e1060964e4632c9056daa1 100644 (file)
@@ -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
 
index 89c4a84cc34e69955c9ab7375e254b81d8e8a8d5..af839e8622417f0eae2dbde095a8cd8f3dcbf6ba 100644 (file)
@@ -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
 
index 66536ae44bee088ed9dcb45ccf50f8265106f4fa..65c82e08956fe3ef68f1d46638cb483c604d0674 100644 (file)
@@ -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 (file)
index 0000000..f1e1c86
--- /dev/null
@@ -0,0 +1,23 @@
+Tests for setting the '[,'] marks when joining lines.
+
+STARTTEST
+:so small.vim
+:/^\t\t/
+0gqj\e
+: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 (file)
index 0000000..3b1df79
--- /dev/null
@@ -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]'
index 900051917aa4bfcd22a3571a4bc76ac6af15bc1d..5aae1d2a7056dda3d9fb611945eaf6a23c63c009 100644 (file)
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    267,
 /**/
     266,
 /**/