summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2015-04-21 18:33:48 +0200
committerBram Moolenaar <Bram@vim.org>2015-04-21 18:33:48 +0200
commit79278367337be1e9a12222698642dcce0af1e059 (patch)
treee7ed1960e4cb4fdf3940d7f2212b2c6bf65ca820 /src
parent40ce3a4e1f50badb75ca812e26557a9bc5fde8c6 (diff)
patch 7.4.710v7.4.710
Problem: It is not possible to make spaces visibible in list mode. Solution: Add the "space" item to 'listchars'. (David Bürgin, issue 350)
Diffstat (limited to 'src')
-rw-r--r--src/globals.h1
-rw-r--r--src/screen.c12
-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.mms3
-rw-r--r--src/testdir/Makefile1
-rw-r--r--src/testdir/test_listchars.in53
-rw-r--r--src/testdir/test_listchars.ok16
-rw-r--r--src/version.c2
11 files changed, 87 insertions, 6 deletions
diff --git a/src/globals.h b/src/globals.h
index 759c51016e..f0879dc670 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -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);
diff --git a/src/screen.c b/src/screen.c
index 8118828707..f9a847dbde 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -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;
diff --git a/src/testdir/Make_amiga.mak b/src/testdir/Make_amiga.mak
index a9a6fa63e7..102255dfd0 100644
--- a/src/testdir/Make_amiga.mak
+++ b/src/testdir/Make_amiga.mak
@@ -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
diff --git a/src/testdir/Make_dos.mak b/src/testdir/Make_dos.mak
index e110277566..787d76eaa0 100644
--- a/src/testdir/Make_dos.mak
+++ b/src/testdir/Make_dos.mak
@@ -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 \
diff --git a/src/testdir/Make_ming.mak b/src/testdir/Make_ming.mak
index 4ec49d505f..e6942c6238 100644
--- a/src/testdir/Make_ming.mak
+++ b/src/testdir/Make_ming.mak
@@ -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 \
diff --git a/src/testdir/Make_os2.mak b/src/testdir/Make_os2.mak
index 7cdfcb105f..224f6951ab 100644
--- a/src/testdir/Make_os2.mak
+++ b/src/testdir/Make_os2.mak
@@ -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 \
diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms
index 496f8228ae..a936d2722e 100644
--- a/src/testdir/Make_vms.mms
+++ b/src/testdir/Make_vms.mms
@@ -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 \
diff --git a/src/testdir/Makefile b/src/testdir/Makefile
index bc094e1763..dfcee81994 100644
--- a/src/testdir/Makefile
+++ b/src/testdir/Makefile
@@ -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
index 0000000000..1f19afa1a9
--- /dev/null
+++ b/src/testdir/test_listchars.in
@@ -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
index 0000000000..1377a84a99
--- /dev/null
+++ b/src/testdir/test_listchars.ok
@@ -0,0 +1,16 @@
+>-------aa>-----$
+..bb>---<<$
+...cccc><$
+dd........ee<<>-$
+<$
+>-------aa>-----$
+..bb>---..$
+...cccc>.$
+dd........ee..>-$
+.$
+
+
+..fff>--<<$
+>-------gg>-----$
+.....h>-$
+iii<<<<><<$
diff --git a/src/version.c b/src/version.c
index 850f37c4cc..06fb40e80d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 710,
+/**/
709,
/**/
708,