Re: Patch 8.0.1677
On 08-Apr.-2018 21:08, Bram Moolenaar wrote: Patch 8.0.1677 Problem:No compiler warning for wrong format in vim_snprintf(). Solution: Add printf attribute for gcc. Fix reported problems. Files: src/vim.h, src/proto.h, src/eval.c, src/fileio.c, src/mbyte.c, src/ops.c, src/spellfile.c, src/undo.c, src/json.c After this patch (and 8.0.1679 as well) mingw (32 and 64 bit) throws these warnings: gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DFEAT_MBYTE -pipe -march=native -Wall -fomit-frame-pointer -freg-struct-return -s eval.c -o gobjnative/eval.o eval.c: In function 'get_tv_string_buf_chk': eval.c:7107:46: warning: unknown conversion type character 'l' in format [-Wformat=] vim_snprintf((char *)buf, NUMBUFLEN, "%lld", ^ eval.c:7107:43: warning: too many arguments for format [-Wformat-extra-args] vim_snprintf((char *)buf, NUMBUFLEN, "%lld", ^~ ... gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DFEAT_MBYTE -pipe -march=native -Wall -fomit-frame-pointer -freg-struct-return -s fileio.c -o gobjnative/fileio.o fileio.c: In function 'msg_add_lines': fileio.c:5318:12: warning: unknown conversion type character 'l' in format [-Wformat=] "%ldL, %lldC", lnum, (long long)nchars); ^ fileio.c:5318:3: warning: too many arguments for format [-Wformat-extra-args] "%ldL, %lldC", lnum, (long long)nchars); ^ In file included from fileio.c:14:0: vim.h:581:24: warning: unknown conversion type character 'l' in format [-Wformat=] # define _(x) ((char *)(x)) ^ fileio.c:5330:7: note: in expansion of macro '_' _("%lld characters"), (long long)nchars); ^ vim.h:581:24: warning: too many arguments for format [-Wformat-extra-args] # define _(x) ((char *)(x)) ^ fileio.c:5330:7: note: in expansion of macro '_' _("%lld characters"), (long long)nchars); ^ ... gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DFEAT_MBYTE -pipe -march=native -Wall -fomit-frame-pointer -freg-struct-return -s json.c -o gobjnative/json.o json.c: In function 'json_encode_item': json.c:219:49: warning: unknown conversion type character 'l' in format [-Wformat=] vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld", ^ json.c:219:46: warning: too many arguments for format [-Wformat-extra-args] vim_snprintf((char *)numbuf, NUMBUFLEN, "%lld", ^~ ... gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_DIRECTX -DDYNAMIC_DIRECTX -DFEAT_DIRECTX_COLOR_EMOJI -DFEAT_GUI_W32 -DFEAT_CLIPBOARD -DFEAT_MBYTE -pipe -march=native -Wall -fomit-frame-pointer -freg-struct-return -s ops.c -o gobjnative/ops.o ops.c: In function 'do_addsub': ops.c:5979:47: warning: unknown conversion type character 'l' in format [-Wformat=] vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", ^ ops.c:5979:44: warning: too many arguments for format [-Wformat-extra-args] vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", ^~ ops.c:5982:47: warning: unknown conversion type character 'l' in format [-Wformat=] vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", ^ ops.c:5982:44: warning: too many arguments for format [-Wformat-extra-args] vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", ^~ ops.c:5985:47: warning: unknown conversion type character 'l' in format [-Wformat=] vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", ^ ops.c:5985:44: warning: too many arguments for format [-Wformat-extra-args] vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", ^~ ops.c:5988:47: warning: unknown conversion type character 'l' in format [-Wformat=] vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", ^ ops.c:5988:44: warning: too many arguments for format [-Wformat-extra-args] vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", ^~ In file included from ops.c:15:0: ops.c: In function 'cursor_pos_info': vim.h:581:24: warning: unknown conversion type character 'l' in format
Re: [vim/vim] Indenting breaking block insert (#2778)
On Mi, 04 Apr 2018, Christian Brabandt wrote: > Take this file: > ```vim > let a=[ > 'eins', > 'zwei', > 'drei'] > ``` > Start vim in a clean mode: `vim --clean -c 'set sw=2 et' file.vim` > > Go to the beginning of the single quotation marks, block select them and try > to add `backslashes in front of them, so that it will become a valid > expression: > > `ggjf'2jI\ ` > > The file will look now like this: > > ```vim > let a=[ > \ 'eins', > 'zwe\ 'eini', > 'dre\ 'eini'] > ``` > > I think the problem is that typing the `backslash` triggers the indent > expression to kick in and the block insert code did not expect that to happen. Attached is a patch that fixes the issue including a test. In addition, it fixes a misplaced comment. Best, Christian -- "Was sind Tragödien anders als versifizierte Passionen solcher Leute, die sich aus den äußern Dingen ich weiß nicht was machen?" -- Goethe, Maximen und Reflektionen, Nr. 157 -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. From 26ab950985834579740171f4af6f1f924eb85493 Mon Sep 17 00:00:00 2001 From: Christian BrabandtDate: Mon, 9 Apr 2018 21:54:46 +0200 Subject: [PATCH] Fix indenting breaking block editing fixes #2778 --- src/ops.c | 9 ++--- src/testdir/Make_all.mak | 1 + src/testdir/test_blockedit.vim | 20 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 src/testdir/test_blockedit.vim diff --git a/src/ops.c b/src/ops.c index 1318e2ce7..19be17935 100644 --- a/src/ops.c +++ b/src/ops.c @@ -1093,7 +1093,7 @@ do_record(int c) if (Recording == FALSE) /* start recording */ { - /* registers 0-9, a-z and " are allowed */ + /* registers 0-9, a-z and " are allowed */ if (c < 0 || (!ASCII_ISALNUM(c) && c != '"')) retval = FAIL; else @@ -2702,6 +2702,7 @@ op_insert(oparg_T *oap, long count1) if (oap->block_mode) { struct block_def bd2; + int did_indent = FALSE; /* If indent kicked in, the firstline might have changed * but only do that, if the indent actually increased. */ @@ -2710,11 +2711,13 @@ op_insert(oparg_T *oap, long count1) { bd.textcol += ind_post - ind_pre; bd.start_vcol += ind_post - ind_pre; + did_indent = TRUE; } /* The user may have moved the cursor before inserting something, try - * to adjust the block for that. */ - if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX) + * to adjust the block for that. + * But only do it, if the difference does not come from indent kicking in */ + if (oap->start.lnum == curbuf->b_op_start_orig.lnum && !bd.is_MAX && !did_indent) { if (oap->op_type == OP_INSERT && oap->start.col diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index b4e4bc328..ddfb7517a 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -72,6 +72,7 @@ NEW_TESTS = test_arabic.res \ test_autocmd.res \ test_autoload.res \ test_backspace_opt.res \ + test_blockedit.res \ test_breakindent.res \ test_bufwintabinfo.res \ test_cdo.res \ diff --git a/src/testdir/test_blockedit.vim b/src/testdir/test_blockedit.vim new file mode 100644 index 0..4a8d59952 --- /dev/null +++ b/src/testdir/test_blockedit.vim @@ -0,0 +1,20 @@ +" Test for block inserting +" +" TODO: rewrite test39.in into this new style test + +func Test_blockinsert_indent() + new + filetype plugin indent on + setlocal sw=2 et ft=vim + call setline(1, ['let a=[', ' ''eins'',', ' ''zwei'',', ' ''drei'']']) + call cursor(2, 3) + exe "norm! \2jI\\ \" + call assert_equal(['let a=[', ' \ ''eins'',', ' \ ''zwei'',', ' \ ''drei'']'], +\ getline(1,'$')) + " reset to sane state + filetype off + bwipe! +endfunc + + +" vim: shiftwidth=2 sts=2 expandtab -- 2.16.1
Issue with when wrap, linebreak, and breakindent are set
When the settings wrap, linebreak, and breakindent any line that consists of whitespace followed by a single word (anything not caught by linebreak) causes a visually empty line to appear. The visual line contains only the whitespace and the word is put on the next line. I have included images as examples. Single_line.png shows a line full of text with the three settings and Extra_line.png shows the result of adding a non-whitespace character to that line. >From my testing I have been able to recreate this issue for the latest release >of vim for ubuntu and vim version 7.4.1689 run on a crouton enabled chromebook. -- -- 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 vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.