]> granicus.if.org Git - vim/commitdiff
patch 7.4.710 v7.4.710
authorBram Moolenaar <Bram@vim.org>
Tue, 21 Apr 2015 16:33:48 +0000 (18:33 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 21 Apr 2015 16:33:48 +0000 (18:33 +0200)
Problem:    It is not possible to make spaces visibible in list mode.
Solution:   Add the "space" item to 'listchars'. (David Bürgin, issue 350)

12 files changed:
runtime/doc/options.txt
src/globals.h
src/screen.c
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_listchars.in [new file with mode: 0644]
src/testdir/test_listchars.ok [new file with mode: 0644]
src/version.c

index 24a65bbecf86f1d72c1f0abe9e38ded942247383..a3f6e126525308222383408d41626886c1d46e96 100644 (file)
@@ -4717,31 +4717,35 @@ A jump table for the options with a short description can be found at |Q_op|.
                        {not in Vi}
        Strings to use in 'list' mode and for the |:list| command.  It is a
        comma separated list of string settings.
-                                                       *lcs-eol*
+                                                       *lcs-eol*
          eol:c         Character to show at the end of each line.  When
                        omitted, there is no extra character at the end of the
                        line.
-                                                       *lcs-tab*
+                                                       *lcs-tab*
          tab:xy        Two characters to be used to show a tab.  The first
                        char is used once.  The second char is repeated to
                        fill the space that the tab normally occupies.
                        "tab:>-" will show a tab that takes four spaces as
                        ">---".  When omitted, a tab is show as ^I.
-                                                       *lcs-trail*
+                                                       *lcs-space*
+         space:c       Character to show for a space.  When omitted, spaces
+                       are left blank.
+                                                       *lcs-trail*
          trail:c       Character to show for trailing spaces.  When omitted,
-                       trailing spaces are blank.
-                                                       *lcs-extends*
+                       trailing spaces are blank.  Overrides the "space"
+                       setting for trailing spaces.
+                                                       *lcs-extends*
          extends:c     Character to show in the last column, when 'wrap' is
                        off and the line continues beyond the right of the
                        screen.
-                                                       *lcs-precedes*
+                                                       *lcs-precedes*
          precedes:c    Character to show in the first column, when 'wrap'
                        is off and there is text preceding the character
                        visible in the first column.
-                                                       *lcs-conceal*
+                                                       *lcs-conceal*
          conceal:c     Character to show in place of concealed text, when
                        'conceallevel' is set to 1.
-                                                       *lcs-nbsp*
+                                                       *lcs-nbsp*
          nbsp:c        Character to show for a non-breakable space (character
                        0xA0, 160).  Left blank when omitted.
 
@@ -4754,7 +4758,7 @@ A jump table for the options with a short description can be found at |Q_op|.
            :set lcs=tab:>-,eol:<,nbsp:%
            :set lcs=extends:>,precedes:<
 <      The "NonText" highlighting will be used for "eol", "extends" and
-       "precedes".  "SpecialKey" for "nbsp", "tab" and "trail".
+       "precedes".  "SpecialKey" for "nbsp", "space", "tab" and "trail".
        |hl-NonText| |hl-SpecialKey|
 
                        *'lpl'* *'nolpl'* *'loadplugins'* *'noloadplugins'*
index 759c51016ebd4fca818662205831630ff0dbe28f..f0879dc670d7feac463e7fde468ae62c145f1334 100644 (file)
@@ -1163,6 +1163,7 @@ EXTERN int        lcs_eol INIT(= '$');
 EXTERN int     lcs_ext INIT(= NUL);
 EXTERN int     lcs_prec INIT(= NUL);
 EXTERN int     lcs_nbsp INIT(= NUL);
+EXTERN int     lcs_space INIT(= NUL);
 EXTERN int     lcs_tab1 INIT(= NUL);
 EXTERN int     lcs_tab2 INIT(= NUL);
 EXTERN int     lcs_trail INIT(= NUL);
index 811882870740684f7d6da50b3b3b6c0d22b02259..f9a847dbdec6fbec0c621c786143916d0664f58a 100644 (file)
@@ -4334,14 +4334,16 @@ win_line(wp, lnum, startrow, endrow, nochange)
 #endif
            ++ptr;
 
-           /* 'list' : change char 160 to lcs_nbsp. */
-           if (wp->w_p_list && (c == 160
+           /* 'list': change char 160 to lcs_nbsp and space to lcs_space. */
+           if (wp->w_p_list
+                   && (((c == 160
 #ifdef FEAT_MBYTE
-                       || (mb_utf8 && mb_c == 160)
+                         || (mb_utf8 && mb_c == 160)
 #endif
-                       ) && lcs_nbsp)
+                        ) && lcs_nbsp)
+                       || (c == ' ' && lcs_space && ptr <= line + trailcol)))
            {
-               c = lcs_nbsp;
+               c = (c == ' ') ? lcs_space : lcs_nbsp;
                if (area_attr == 0 && search_attr == 0)
                {
                    n_attr = 1;
index a9a6fa63e70d8c9f3365188877c2ad00b5be9098..102255dfd0bdcb531b6b99f458daa010195d98a9 100644 (file)
@@ -46,6 +46,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
                test_erasebackword.out \
                test_eval.out \
                test_insertcount.out \
+               test_listchars.out \
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
@@ -189,6 +190,7 @@ test_command_count.out: test_command_count.in
 test_erasebackword.out: test_erasebackword.in
 test_eval.out: test_eval.in
 test_insertcount.out: test_insertcount.in
+test_listchars.out: test_listchars.in
 test_listlbr.out: test_listlbr.in
 test_listlbr_utf8.out: test_listlbr_utf8.in
 test_mapping.out: test_mapping.in
index e11027756609d2c91dc5a2d64bee3f6c8e30459f..787d76eaa0a5a1f9fe63761beab7b40e136651cd 100644 (file)
@@ -45,6 +45,7 @@ SCRIPTS =     test3.out test4.out test5.out test6.out test7.out \
                test_erasebackword.out \
                test_eval.out \
                test_insertcount.out \
+               test_listchars.out \
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
index 4ec49d505f8342000377fd7b20661c879b55c5f6..e6942c62385d16a93f8b67a94e9e86c09c14f4f9 100644 (file)
@@ -67,6 +67,7 @@ SCRIPTS =     test3.out test4.out test5.out test6.out test7.out \
                test_erasebackword.out \
                test_eval.out \
                test_insertcount.out \
+               test_listchars.out \
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
index 7cdfcb105f72b22e5fb1d24990143d1b1c3fc4b1..224f6951abc5fa26f16d55ad6e228ed374a6c515 100644 (file)
@@ -47,6 +47,7 @@ SCRIPTS = test1.out test3.out test4.out test5.out test6.out \
                test_erasebackword.out \
                test_eval.out \
                test_insertcount.out \
+               test_listchars.out \
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
index 496f8228ae12cd8094f3ac44dd8e217f4a517966..a936d2722e70a48504085b55db58e525b9486429 100644 (file)
@@ -4,7 +4,7 @@
 # Authors:     Zoltan Arpadffy, <arpadffy@polarhome.com>
 #              Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
 #
-# Last change:  2015 Mar 24
+# Last change:  2015 Apr 21
 #
 # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
 # Edit the lines in the Configuration section below to select.
@@ -106,6 +106,7 @@ SCRIPT = test1.out  test2.out  test3.out  test4.out  test5.out  \
         test_erasebackword.out \
         test_eval.out \
         test_insertcount.out \
+        test_listchars.out \
         test_listlbr.out \
         test_listlbr_utf8.out \
         test_mapping.out \
index bc094e1763654fc7d7f3febb4aa8e956486c9a99..dfcee819947574f43ea9551e3a770fba0fd6b32a 100644 (file)
@@ -43,6 +43,7 @@ SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
                test_erasebackword.out \
                test_eval.out \
                test_insertcount.out \
+               test_listchars.out \
                test_listlbr.out \
                test_listlbr_utf8.out \
                test_mapping.out \
diff --git a/src/testdir/test_listchars.in b/src/testdir/test_listchars.in
new file mode 100644 (file)
index 0000000..1f19afa
--- /dev/null
@@ -0,0 +1,53 @@
+Tests for 'listchars' display with 'list' and :list
+
+STARTTEST
+:so small.vim
+:let g:lines = []
+:function GetScreenCharsForLine(lnum)
+:  return join(map(range(1, virtcol('$')), 'nr2char(screenchar(a:lnum, v:val))'), '')
+:endfunction
+:nnoremap <expr> GG ":call add(g:lines, GetScreenCharsForLine(".screenrow()."))\<CR>"
+:set listchars+=tab:>-,space:.,trail:<
+:set list
+:
+/^start:/
+:normal! jzt
+GG
+GG
+GG
+GG
+GGH:
+:set listchars-=trail:<
+GG
+GG
+GG
+GG
+GG:
+:put =g:lines
+:'[,']w! test.out
+ENDTEST
+
+start:
+       aa      
+  bb     
+   cccc         
+dd        ee   
+
+
+STARTTEST
+:set listchars+=trail:<
+:set nolist
+:
+/^start:/
+:redir! >> test.out
+:+1,$list
+:redir END
+:q!
+ENDTEST
+
+start:
+  fff    
+       gg      
+     h 
+iii              
diff --git a/src/testdir/test_listchars.ok b/src/testdir/test_listchars.ok
new file mode 100644 (file)
index 0000000..1377a84
--- /dev/null
@@ -0,0 +1,16 @@
+>-------aa>-----$
+..bb>---<<$
+...cccc><$
+dd........ee<<>-$
+<$
+>-------aa>-----$
+..bb>---..$
+...cccc>.$
+dd........ee..>-$
+.$
+
+
+..fff>--<<$
+>-------gg>-----$
+.....h>-$
+iii<<<<><<$
index 850f37c4cca505ea97f9abe4c2788b0e4f95fd9c..06fb40e80dac4ba13f14e0bfa6605602712ec343 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    710,
 /**/
     709,
 /**/